Computer Science
What will be the output displayed when addEM() is called/executed?
def addEM(x, y, z):
return x + y + z
x=y=z=20
Python Functions
2 Likes
Answer
When the addEM() function is called or executed, there will be no output displayed because there is no print statement.
Explanation
When the function addEM(x, y, z) is called with the values 20 for each of its parameters (x, y, and z), it calculates their sum (20 + 20 + 20), which equals 60. Since the function uses the return keyword to return this calculated sum, calling addEM(20, 20, 20) will return 60.
Answered By
3 Likes
Related Questions
Consider the following code and write the flow of execution for this. Line numbers have been given for your reference.
1. def power(b, p): 2. y = b ** p 3. return y 4. 5. def calcSquare(x): 6. a = power(x, 2) 7. return a 8. 9. n = 5 10. result = calcSquare(n) 11. print(result)What will the following function return?
def addEm(x, y, z): print(x + y + z) x = y = z = 10What are variables ? How are they important for a program ?
What will be the output of following program ?
num = 1 def myfunc(): num = 10 return num print(num) print(myfunc()) print(num)