+ 1
Can anyone help me with this RETURN question ?
Iām practicing RETURN, when i try with this code I get No Output, and I should get 2, is anything wrong with it? def sqrt(value): return value ** (1/2) sqrt(4)
6 Answers
+ 7
You output no value. Write print(sqrt(4)) to print the value returned by the function.
+ 4
# not š
return, but print()
def sqrt(value):
print(value ** (1/2))
sqrt(4)
+ 3
Yeah but with the first method the range of use for that function is smaller than in the second method. #1 is a function that prints the value while #2 can be used in different formulas which don't necesarily need to be printed.
+ 1
0
If you need to show something is return we use print()