Q. What is wrong with the following function definition?
def addEm(x, y, z):
return x + y + z
print("the answer is", x + y + z)
Answer =
Return is written before print , so when function will call then print statement will not give any result.
When function called then it will add all the argument and it will show no result.
So basically in this question what is wrong. return written before print is wrong?
ReplyDeleteYes.
Deleteji
ReplyDelete: )
Deletethnks..it helped a lot!!
ReplyDeleteWelcome : )
Deletethank you
ReplyDeleteWelcome : )
DeleteThe function myfunc() refers y and a as local variables. So we are making them(y,a) as global variables before proceeding with the code.
ReplyDeleteIs my understanding correct or not?
Yes.
DeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )