What the elif is this?
- The
elifcommand (which stands for 'elseif') allows you to ask 2, 3, 4 or 142 questions using the same input! This command must be in a certain place. You can have as manyelifstatements as you want, but they must go in betweenifandelseand have the same indentation. Theprintstatements in yourelifcommand need to line up with the indent of the otherprintstatements.
EXAMPLE :
print("SECURE LOGIN")
username = input("Username > ")
password = input("Password> ")
if username == "mark" and password == "password":
print("Welcome Mark!")
elif username == "suzanne":
print("Hey there Suzanne!")
else:
print("Go away!")
E
Comments
Post a Comment