Adding Many Choices
Challenge 1-6: Logic with If Statements
Challenge 1-6: Logic with If Statements
What if we want to add many choices? What would that look like?
"If we have chocolate biscuits, I'll take two.
Or else if we have cake, I'll have a slice!
Or else if there's cherry pie, give me 2 slices!
Or I’ll just have a banana."
To add more choices to our code, we would use the elif clause:
>>> if myname == "Morgan":
... print("Hi Morgan!")
... elif myname == "Alfred":
... print("Hi Alfred!")
... else:
... print("Who are you?!?")