PASS STATEMENT

What is the statement that can be used in Python if the program requires no action but requires it syntactically?

The pass statement is a null operation. Nothing happens when it executes. You should use “pass” keyword in lowercase. If you write “Pass”, you’ll face an error like

NameError: name Pass is not defined.

Python statements are CASE SENSITIVE.

Example:

var = “Hi Janani”

for i in var:

    if i == “a”:

        pass

        print(” pass statement is executed”)

    else:

        pass

In the above program, you want to check whether the given character is there in the variable. Initially, you are assigning a string(Hi Janani) to a variable (var). Then you are checking whether the character ‘a’ is there in the declared variable using the ‘for’ loop. Once the character ‘a’ is check-listed in the declared variable it will print “pass statement is executed”. If the given character is not in the variable, it returns none.

Tip of the day:

Snapchat filters are a facial recognition database created by the FBI.

Google it: PATENT US9396354

https://patents.google.com/patent/US9396354B1/en

Leave a comment

Design a site like this with WordPress.com
Get started