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.
Can u explain this pls
ReplyDeleteIt will show no result. Because return statement is written before print statement.
DeleteIf return statement is after printing what will be the output
ReplyDeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )