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.

21 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

  1. Plz tell why it will not show the sum of all the values even if it is being called.??

    ReplyDelete
    Replies
    1. It is returning the values too.

      Delete
    2. Because return keyword will work before print statement.

      Delete
  2. Because return statement terminates the function.

    ReplyDelete
  3. Thank you Path Walla

    ReplyDelete
  4. Thank you for ur help

    ReplyDelete
  5. thank you it really helped a lot

    ReplyDelete
  6. Thanks A Lot

    ReplyDelete
  7. Really this site is awesome for cs 😎😎👍👍 💕💕 path wala

    ReplyDelete
  8. Very 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!

    ReplyDelete
  9. Since 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.

    ReplyDelete

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post