It is returning the value, you simply are not capturing it or doing anything with it. For instance:
def triangle_area(b, h):
return 0.5 * b * h
output = triangle_area(20, 10) # capture return value
print(output)
Or as others have suggested, just pass the result straight to the print
function if that's what you're looking to do:
def triangle_area(b, h):
return 0.5 * b * h
print(triangle_area(20, 10)) # capture return value and immediately pass to print function
Note that the output will be lost if passed straight to print()
. If you want to use it later in your program, the first code block is more appropriate