二手产品经理

二手产品经理

THIS IS RENO

Learn Python Online in 100 Days - Week 3 Day 7

Record#

Today's practice is a math mini-game that uses a for loop to output math questions and calculates the final score.

CODE#

print("Math Game!")
print()
score = 0
n1 = int(input("Enter the number you want to practice: "))
for i in range(1, 11):
    n0 = "{} * {} = ".format(i, n1)
    n2 = int(input(n0))
    if n2 == (i * n1):
        print("Correct, great job.")
        score += 1
    else:
        print("Oops, wrong answer. The correct answer is: ", i * n1)

print("Your score is: ", score, ".")
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.