Texts: How do I fix the error to obtain an output?
(uoA) rap/d
FileEdit Search
Debug Consoles Projects Tools View Help
1
a
a
T
EI
C:Users
oahd.spyder-py3
C:Users
oahd).spyder-py3untitled2.py
-
+
Q
ariables(code).py X
writing_functions(code).py
more_linear_interpolation(code)2.py
tau.py
untitled2.py*
Name
Type
Size
Value
7
24 25 26
slope = (y2 - y1) / (x2 - x1) return y1 + slope * (x - x1)
Convert a string or number to a floating point number, if possible BTP_hr float 1
1.0
3.412142
17
def main(): # Prompt the user to enter the time and position at two points. time_1 = float(input("Enter time i: ")) x_1 = float(input("Enter the x position of the object at time I: ")) y_1 = float(input("Enter the y position of the object at time I: ")) z_1 = float(input("Enter the z position of the object at time I: ")) time_2 = float(input("Enter time 2: ")) x_2 = float(input("Enter the x position of the object at time 2: ")) y_2 = float(input("Enter the y position of the object at time 2: ")) z_2 = float(input("Enter the z position of the object at time 2: "))
conv_fac = float(.621371)
29
deg_celsius = float(1.0)
deg_rankine = float(493.47)
digits = int(float(2.718281828459045))
Fahrenheit = float(33.8)
# Calculate the times and positions for three evenly spaced points between the two points en times = [time_1 + time_2 - time_1 * i for i in range(3)] positions = [linear_interpolation(time_1, x_1, time_2, x_2, time) for time in times]
Help Variable Explorer Plots Files
68
40
Console 1/A
42
43
In [14]: runfile('C:/Users/noahd/.spyder-py3/untitled2.py', wdir='c:/Users/noahd/.spyder-py3') Traceback (most recent call last):
44
# Print the results using nice formatting. print("At time 1.0 seconds the object is at") print(f"{times[0]:.2f}, {positions[0][0]:.3f}, {positions[0][1]:.3f}, {positions[0][2]:.3f}") print("At time 1.25 seconds the object is at") print(f"{times[1]:.2f}, {positions[1][0]:.3f}, {positions[1][1]:.3f}, {positions[1][2]:.3f}") print("At time 1.5 seconds the object is at") print(f"{times[2]:.2f}, {positions[2][0]:.3f}, {positions[2][1]:.3f}, {positions[2][2]:.3f}") print("At time 1.75 seconds the object is at") print(f"{times[3]:.2f}, {positions[3][0]:.3f}, {positions[3][1]:.3f}, {positions[3][2]:.3f}") print("At time 2.0 seconds the object is at") print(f"{times[4]:.2f}, {positions[4][0]:.3f}, {positions[4][1]:.3f}, {positions[4][2]:.3f}")
15
46
47
48
File ~anaconda3Libsite kernelspy3compat.py:356 in compat_exec exec(code, globals, locals)
49
File c:users
oahd.spyder-py3untitled2.py:56 if __name__ == '__main__':
54 55
NameError: name 'Arithmetic' is not defined
if __name__ == '__main__':
main()
In [15]:
IPython Console History LSP:Python Line 59. Col 3 UTF-8 CRLF
conda (Python 3.11.4)
Mem 51%