- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to return none from Python function?
Functions without a return statement known as void functions return None from the function. To return a value other than None, you need to use a return statement in the functions; and such functions are called fruitful functions.
Values like None, True and False are not strings: they are special values and keywords in python and are part of the syntax.
If we get to the end of any function and we have not explicitly executed any return statement, Python automatically returns the value None.
Some functions exists purely to perform actions rather than to calculate and return a result. Such functions are called procedures.
One sample code is given below that returns None.
def lyrics(): pass a = lyrics() print a
- How to return void from Python function?
- How to return a json object from a Python function?
- How to return an object from a function in Python?
- How to return table from MySQL function?
- How can we return a dictionary from a Python function?
- How can we return a tuple from a Python function?
- How can we return a list from a Python function?
- How to return a JSON object from a Python function in Tkinter?
- How can a Python function return a function?
- How to return variable value from jQuery event function?
- How to return local array from a C++ function?
- How to return an array from a function in C++?