Def sum(x, y): return(x+y) print(sum(sum(1,2), sum(3,4)))
Answers
Answer:
1, def sum(x, y):. 2, sum = x + y. 3, if sum in range(15, 20):. 4, return 20. 5, else: 6, return sum. 7. 8, print(sum(10, 6)).
Answer:
Explanation:
Return is a statement that conveys a program to left the subroutine and go back to the return address. The return address is situated where the subroutine was called. In most programming languages, the return statement is either return or return value, where value is a variable or other tasks coming back from the subroutine.
Given:
return(x+y)
print(sum(sum(1,2), sum(3,4)))
Find:
Sum(x,y)
Solution:
It will first figure out sum(1,2) that is 3
Then it calculate sum (3,4) which is 7
and finally it will evaluate both 3 and 7 which is 10
The output will be 10
#SPJ2