Q. What will the following function print when called?
def addEm(x, y, z):
return x + y + z
print (x+ y + z)
Answer =
When function called then it will add all the argument and it will show nothing.
Because return keyword will work before print statement.
Plz tell why it will not show the sum of all the values even if it is being called.??
ReplyDeleteIt is returning the values too.
DeleteBecause return keyword will work before print statement.
DeleteBecause return statement terminates the function.
ReplyDeleteright...
DeleteThank you Path Walla
ReplyDeleteWelcome 😊😊😊
DeleteThank you for ur help
ReplyDeleteWelcome 😊😀🤗🤗
Deletethank you it really helped a lot
ReplyDeleteWelcome 😊😀🤗🤗
DeleteThanq
ReplyDeleteWelcome : )
DeleteThanks A Lot
ReplyDeleteWelcome : )
DeleteReally this site is awesome for cs 😎😎👍👍 💕💕 path wala
ReplyDeleteAlways Welcome : )
Delete: )
ReplyDeleteVery helpful website but just a mere suggestion to include all questions with answers below instead of clicking links.it makes it easier to read and access. But really appreciate the effort!
ReplyDeleteThankyou : ). But We can't do so.
DeleteSince the return statement is encountered first, the function exits immediately after returning the sum. The print statement after the return statement is never executed. Therefore, it prints nothing.
ReplyDeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )