[Type B] Working with Functions – Chapter 3 Sumita Arora

|
Table of Contents

9. Write a function namely fun that takes no parameters and always returns None.

Solution: In this case, the function fun simply returns the value None using the return statement.

Python
def fun():
    return None

The None value in Python represents the absence of a value. It’s often used to indicate that a function doesn’t produce any meaningful result or when a variable has no value assigned to it.

In summary, the function fun doesn’t perform any significant operation but returns None whenever it’s called. This can be useful in situations where you need to call a function for its side effects (such as printing to the console or modifying global variables) rather than for its return value.

"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 *