Computer Science
What will the following function return ?
def addEm(x, y, z):
print(x + y + z)
Python Functions
10 Likes
Answer
The function addEm will return None. The provided function addEm takes three parameters x, y, and z, calculates their sum, and then prints the result. However, it doesn't explicitly return any value. In python, when a function doesn't have a return statement, it implicitly returns None. Therefore, the function addEm will return None.
Answered By
5 Likes
Related Questions
Find and write the output of the following python code :
def Call(P = 40, Q = 20): P = P + Q Q = P - Q print(P, '@', Q) return P R = 200 S = 100 R = Call(R, S) print(R, '@', S) S = Call(S) print(R, '@', S)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 print when called ?
def addEm(x, y, z): return x + y + z print(x + y + z)What will be the output of following program ?
num = 1 def myfunc(): return num print(num) print(myfunc()) print(num)