 # Help - Getting Ready for Phsyics Class Python Lesson - Function generating 'None

I have a hard time understanding why the line of code below gives me ‘None’ when I run it:
`train_force = get_force(train_mass,train_acceleration)`

Both train_mass and train_acceleration are defined at the beginning of the code, so I added them to the get_force() function to test if it runs correctly, but instead of giving me the value I expect (226800) it gives me None.

I even tried writing get_force(22680,10) and again the result is None when I try to print it.

Is there an error in my function, is this a data type issue, or something completely different I have overlooked? If someone could explain this to me, I’d be really grateful as I am stuck and not sure why.

Please find the whole code below.
Thank you! ``````train_mass = 22680
train_acceleration = 10
train_distance = 100

bomb_mass = 1

#farenheit to celsius conversion
def f_to_c(f_temp):
c_temp =  (f_temp - 32) * 5/9
return print(c_temp)

f100_in_celsius = f_to_c (100)

#celsius to farenheit conversion
def c_to_f(c_temp):
f_temp = c_temp *9/5 +32
return print(f_temp)

c0_in_farenheit = c_to_f(0)

#force equation

def get_force(mass,acceleration):
return print(mass*acceleration)

train_force = get_force(train_mass,train_acceleration)
print(train_force)

print('The GE trains supplies ' + str(train_force) + ' Newtons of force.')
``````

A print statement returns None, so that is what your function returns To return the actual value, that’s what you should write. So, don’t return the print of the value, return the value directly.

Later, if you want to print that value, you can print it outside of the function definition. Which you are doing already. However, because now the returns of your functions are None, then that is what is printed.

1 Like

Ohhhh!!! Thank you so much for the clear explanation, it makes sense now. 