二手产品经理

二手产品经理

THIS IS RENO

Learn Python Online in 100 Days - Day 5

Today I learned about if and else, as well as the importance of indentation!

Learning Record

  1. 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.
  2. The condition for if is double equal sign, single equal sign is for assignment.
  3. Note that a colon should be added after the if condition and after else.
  4. 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!")
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.