129k views
0 votes
What will be displayed after the following code is executed? def pass_it(x, y): z = x*y result = get_result(z) return(result) def get_result(number): z = number + 2 return(z) num1 = 3 num2 = 4 answer = pass_it(num1, num2) print(answer)

1 Answer

4 votes

Answer:

The output of the following code is "14".

Explanation:

In the python program firstly we define a function that is pass_it() function. In this function, we pass the two variable that is x,y. Then we define two variable z and result in the function. The z variable is used to store the multiplication value of the x,y. In the result variable, we use another function that is get_result() function in this function we pass the value of the z variable as a parameter. This function adds a value that is 2 and returns its value. Then we declare a variable that is num1 and num2. In this variable, we assign value that is 3 and 4 and return value of the pass_it() function in the answer variable and print it.

User Stefano Fratini
by
5.1k points