二手产品经理

二手产品经理

THIS IS RENO

Learn Python Online in 100 Days - Week 3, Day 2

Record#

  1. Continue learning while loops. Today I learned the combination of True and break, which can reduce the use of a variable and some code, and make 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, it's 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 Yuyue wine cost? "))
    n2 = int(input("How much does a big hammer cost? "))
    n3 = int(input("How much does a small hammer cost? "))
    if n1 != 180 and n2 != 80 and n3 != 40:
        print("You are a fake northerner!")
        break
    else:
        print("You are a real northerner")
        break

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