Q. Consider the code below and answer the questions that follow:


def multiply(number1, number2):

    answer = number1 * number2

    return(answer)

    print(number, 'times', number2, '=', answer)

output = multiply(5,5)


(i) When the code above is executed, what gets printed?

(ii) What is variable output equal to after the code is executed?



Answer =

(i)
It will show no result. Because return statement is written before print statement.

(ii)
Variable is ‘answer’. And its value is 25.

3 Comments

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

  1. Replies
    1. It will show no result. Because return statement is written before print statement.

      Delete
  2. If return statement is after printing what will be the output

    ReplyDelete

Post a Comment

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

Previous Post Next Post