Went further into if/elif/else statements, which is looking to be very useful to a potential choose your own adventure code game I’m thinking of making.
Learned that you can pack elif statements within a larger elif which allows for multiple potential trails of code depending on the variables. Par example… when in conversation with a pirate:
print(“How many years old are you? \n”)
age = int(input())
if age > 18:
print(“\nYou’re a strapping young lad, will you come work for me?\n”)
answer = input()
if answer == “yes”:
print(“\nYou made the right choice”)
elif answer == “no”:
print(“\nFine then I won’t be your friend”)
print(“\nI don’t quite understand you. You must be dumb”)
Small thing I learned:
It’s important to use ‘==’ instead of ‘=’ when comparing values, ‘=’ is used when defining a variable.
Man I’m getting excited at the potentials here for some creativity 🙂