 # LEARN PYTHON 3 Getting Ready for Physics Class....stuck here

train_mass = 22680

train_acceleration = 10

train_distance = 100

bomb_mass = 1

def f_to_c(f_temp):

return (f_temp - 32) * 5/9

f100_in_celsius=f_to_c(f_temp=100)

print(f100_in_celsius)

def c_to_f(c_temp):

``````return (c_temp * 9/5) + 32
``````

c0_in_fahrenheit = c_to_f(c_temp=0)

print(c0_in_fahrenheit)

def get_force(mass,accelaration):

return mass*accelaration

train_force=get_force(train_mass,train_acceleration)

print("The GE train supplies “+ str(train_force) + " Newtons of force.”)

def get_energy(mass,c=3*10**8):

return mass*c**2

bomb_energy=get_energy(bomb_mass)

print(“A 1kg bomb supplies “+str(bomb_energy)+” Joules.”)

def get_work(mass, acceleration, distance):

force=get_force(mass,accelaration)

return force*distance

train_work=get_work(train_mass,train_acceleration,train_distance)

print(“The GE train does “+str(train_work)+” Joules of work over “+str(train_distance)+” meters.”)

I am getting below error…I am sure i followed the tutorial as explained

Traceback (most recent call last):
File “script.py”, line 35, in
train_work=get_work(train_mass,train_acceleration,train_distance)
File “script.py”, line 32, in get_work
force=get_force(mass,accelaration)
NameError: name ‘accelaration’ is not defined

Please format your code using the </> button so it’s more readable for those trying to help out.

The error you are getting suggests that `accelaration` has not been defined as a variable. I noticed that you’ve used two different spellings of “acceleration” in your code (acceleration is correct, while accelaration is not). This might be the cause of the problem (it’s hard to read the code because it’s not formatted).

Welcome to the forums!

1 Like

Let’s go back to Physics class. Anybody here taken Physics? Let’s start there.

2 Likes