Return function not working

when i try to use the following function to get a return nothing comes up:
def test_return():
return 50
test_return()
for some reason it wont let me indent the return 50 line, but I made sure that it is indented in my work page.
https://www.codecademy.com/paths/visualize-data-with-python/tracks/introduction-to-python-dvp/modules/python-functions-dvp/projects/population-project
Is this an error or am i writing this wrong?

welcome to the forums.

if the code is properly indented, ie: the return statement, it will run.

if you contain your code in backticks, the key left of the 1 that’s similar to the apostrophe, it will format it as code. Containing in one tick, def test_return(): allows short code bits.
Using 3 backticks allows multi line blocks of code:

def test_return():
  return 50
test_return()

Just because a function returns something doesn’t mean anything happens with it. Ask yourself what you want to do with the data your function returns?

1 Like

if you are trying to print the function to the console, you must use the print statement. i.e. print(test_return()) if you want to store it to a variable, it works similarly: sample_var=test_return() which will set sample_var=50