[Type B] Working with Functions – Chapter 3 Sumita Arora
Table of Contents
8. What is wrong with the following function definition?
Python
def addEm(x, y, z):
return x + y + z
print("the answer is", x + y + z)
Solution: The print
statement is placed after the return
statement, which makes it unreachable. Therefore, it won’t be executed.
In short, the print
statement is unreachable.