Conditionals#
1. if-elif-else
#
Fill missing pieces (____
) of the following code such that prints make sense.
name = 'John Doe'
if ____:
print('Name "{}" is more than 20 chars long'.format(name))
length_description = 'long'
elif ____:
print('Name "{}" is more than 15 chars long'.format(name))
length_description = 'semi long'
elif ____:
print('Name "{}" is more than 10 chars long'.format(name))
length_description = 'semi long'
elif ____:
print('Name "{}" is 8, 9 or 10 chars long'.format(name))
length_description = 'semi short'
else:
print('Name "{}" is a short name'.format(name))
length_description = 'short'
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[2], line 1
----> 1 if ____:
2 print('Name "{}" is more than 20 chars long'.format(name))
3 length_description = 'long'
NameError: name '____' is not defined
assert length_description == 'semi short'