0
Basic python difficulty
Just started and was playing with functions and if statements but I canât get it to return true, it keeps just returning with 8. ********************** def f(x): print((x**2) + 4) x = 2 if f(x)==8: print("true") **********************
1 Answer
+ 8
Hi, you need to return the calculation result (instead of printing it) done by the function back to the call of the function f():
def f(x):
#print((x**2) + 4)
return x**2 + 4
x = 2
if f(x)==8:
print("true")
# output: True