Getting Ready for Physics Class

Link for the code:

If you have any recommendations, please feel free to tell me.

The code looks well thought out, and you’ve followed naming conventions-well done!

1 Like

I got the code up to 100 Celcius. However, instead of an output, this came up:

<function f_to_c at 0x7f90fa3d2e18>

What does this mean?

That likely means that when you call your f_to_c function, you don’t put parentheses after the function call:

#wrong:
f_to_c
#right:
f_to_c()#and any arguments it might have

Without your code, though, it is very hard to tell…

Sorry about that. I’m posting the code now. Thanks.

def f_to_c(f_temp):

c_temp = (f_temp - 32) * 5 / 9

return c_temp

print(f_to_c)

f100_in_celcius = f_to_c(100)

As I suspected; when you call the function f_to_c, here:

print(f_to_c)

You don’t actually call the function (remember to call a function, you have to put parentheses after it, with any arguments included:

some_func(arg1, arg2)#calls some_func, and passes in two arguments

What you’re actually doing is printing the memory address of the function.

Sorry to sound obnoxious. but a similar problem emerged even though I had followed the tutorial.

Code for Energy:
def get_energy(mass, c=3 * 108):
return mass * c
2

print(get_energy)

Output: <function get_energy at 0x7f3563a08e18>

Again, when you’re printing (and trying to call) get_engery, you don’t have any parentheses. If the video tutorial does it that way, and are getting that output, then there’s a mistake in it.