
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Write an Empty Function in Python
In this article, we will see how we can create an empty functions in Python. A function is a block of organized, reusable code that is used to perform a single, related action. Functions provide better modularity for your application and a high degree of code reusing.
Function blocks begin with the keyword def followed by the function name and parentheses ( ( ) ). Here, we will see examples of Empty Functions.
Empty Function
Use the pass statement to write an empty function in Python ?
Example
# Empty function in Python def demo(): pass
Above, we have created an empty function demo().
Empty if-else Statement
The pass statement can be used in an empty if-else statements ?
Example
a = True if (a == True) : pass else : print("False")
Above, we have created an empty if-else statement.
Empty while Loop
The pass statement can also be used in an empty while loop ?
Example
cond = True while(cond == True): pass
Above, we have created and empty while loop.
Advertisements