Study Notes
- Today I learned about if and else, which are conditional statements. It means, if (the condition is true) then execute this, otherwise execute that. The "==" means whether the contents on both sides are equal.
- The condition for if is double equal signs, single equal sign is for assignment.
- Note that a colon is required after if condition and else.
- The statements after if and else should be indented, more precisely, the next line after the colon should be indented.
CODE
sp=input("Do you like 'hanging around'?: ")
if sp == "NO":
print("Then you're not Spider-man")
else:
print("You are Spider-man")
korg=input("Do you have a 'gravelly' voice?: ")
if korg=="NO":
print("Aww, then you're not Korg")
else:
print("You are Korg")
mar=input("Do you often feel 'Marvelous'?: ")
if mar=="NO":
print("Then you are not Captain Marvel")
else:
print("Aha! You're Captain Marvel! Hi!")