What are the questions about the usefulness of pass statements in python3?

A novice learner python, would like to ask about the use of the pass statement here.
the last one below is an example on Mr. Liao Xuefeng"s website. what is the purpose of the pass statement? Deleting pass and leaving pass seems to have no effect on the code?

example:
example of "check whether there are city and job parameters in a variable":
def person (name, age, * * kw):

if "city" in kw:
    -sharp city
    pass
if "job" in kw:
    -sharp job
    pass
 print("name:", name, "age:", age, "other:", kw)

Apr.01,2021

The

pass statement does nothing. It can be used when a statement is needed syntactically but the program does not need an action.

Another use of

is to use it as a placeholder for the body or condition of a function when dealing with new code, allowing you to continue thinking at a more abstract level.

reference
https://docs.python.org/3/tutorial/controlflow.html-sharppass-statements
Menu