[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)
"Spread the light within, illuminate the hearts around you. Sharing is not just an action, but a sacred journey of connecting souls."~ Anonymous

Leave a Reply

Your email address will not be published. Required fields are marked *