Today I learned about if and else, as well as the importance of indentation!
Learning Record
- Today I learned about if and else, which are conditional statements. It means that if (the condition is true), execute this part, otherwise execute this part. The meaning of "==" is whether the contents on both sides are equal.
- The condition for if is double equal sign, single equal sign is for assignment.
- Note that a colon should be added after the if condition and after else.
- The statements after if and else should be indented, or more precisely, the next line after the colon should be indented.
CODE
sp=input("Do you like 'hanging aroud'?:" )
if sp == "NO":
print("Then you're not Spider-man")
else:
print("Yor 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 krog")
mar=input("Do you often feel 'Marvelous'?: ")
if mar=="NO":
print("Then you are not Caption Marver")
else:
print("Aha! You're Caption Marver! Hi!")