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.

10 Comments

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

  1. So basically in this question what is wrong. return written before print is wrong?

    ReplyDelete
  2. thnks..it helped a lot!!

    ReplyDelete
  3. The function myfunc() refers y and a as local variables. So we are making them(y,a) as global variables before proceeding with the code.
    Is my understanding correct or not?

    ReplyDelete

Post a Comment

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

Previous Post Next Post