Imagine a path divided in two. To the left is a treasure chest. To the right is a dragon! 🐉
Computers make these decisions using if and else. It's like a gatekeeper.
We check a condition. If it is True, we do the indented code.
== for checking!
Ask the user "What is the password?" using input() and save it in secret.
secret = input("What's the password?")
Add the check! If the password is "Melon", print "Enter friend".
if secret == "Melon":
print("Enter friend")
Don't forget the colon : and the indentation!
Add an else: block to print "Wrong!" if they don't say Melon.
1. How do you check if 'a' is equal to 'b'?