[Type A] Working with Functions – Chapter 3 Sumita Arora
Table of Contents
8. Differentiate between fruitful functions and non-fruitful functions.
Solution:
- Fruitful Functions: These functions return a value after performing operations or calculations.
- Non-fruitful Functions: These functions perform tasks or operations but do not return any value.
Example Code:
Python
# Fruitful Function
def add(x, y):
return x + y
# Non-fruitful Function
def greet(name):
print("Hello,", name)