Python Pass Exercises

Let’s check out some exercises that will help understand pass statement better.

Exercise 20-a

Place a pass statement so that if block won't throw an error.


pass statement is a placeholder in Python so that certain structures can be left unfinished without throwing an error.

if len(name) > 0:
print(name)
else:
pass

Exercise 20-b

Place pass statement in your function so that you can leave it unfinished and it doesn't throw an error.


pass statement is a placeholder in Python so that certain structures can be left unfinished without throwing an error.

def f_1 (x):
pass