0
Weird output for python
#So this is my code. def answer(): answer="I will try" if answer("I will try"): return ("Good luck"); elif answer ("I won't know the result tho"): return ("At least you try"); else: return ("May God bless your efforts"); print (answer) #but my output is <function answer at 0x01295660> #why is this so?
2 Antworten
+ 2
def answer():
answer="I will try"
if answer == "I will try":
return "Good luck"
elif answer == "I won't know the result tho":
return "At least you try"
else:
return "May God bless your efforts"
print(answer())
When you call your function in print() you have to call answer().. you had answer without the ()...
I also replaced your if statements of
If answer("I will try");
with
If answer == "I will try"
+ 1
thanks. :) ur a good guy