二手产品经理

二手产品经理

THIS IS RENO

Learn Python Online in 100 Days - Day 5

Study Notes

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