二手产品经理

二手产品经理

THIS IS RENO

Learn Python in 100 Days Online - Week 3 Day 2

Record#

  1. Continue learning while loops. Today I learned the combination of True and break, which can reduce one variable and some code, making the logic clearer.
  2. The T in True must be capitalized, and the break statement should be inside the while loop.
  3. I am very satisfied with the small game I wrote, hahaha, quite interesting.

CODE#

print("Are you really from the North? ")
print("Let's determine if you are really from the North through 3 tests. ")
while True:
    n1 = int(input("How much does a cup of Gongting Yuye wine cost? "))
    n2 = int(input("How much for a big hammer? "))
    n3 = int(input("How much for a small hammer? "))
    if n1 != 180 and n2 != 80 and n3 != 40:
        print("You are a fake northerner!")
        break
    else:
        print("You are really from the North")
        break

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.