Computational Question

Asked 2 years ago, Updated 2 years ago, 19 views

Create a tuple (["3+2", 5,3], ["6/2", 3,5], ["10-2",8,3], ["2's 3 wins",8,4], ["5-2*2",1,5]) ([problem, answer, score] format)>

Show each question, ask the answer, and accumulate the score if it is correct Show the final number of correct answers and the number of incorrect answers and score output

t = (["3+2",5,3],[6/2",3,5],["10-2",8,3],["2's 3 wins",8,4],[5-2*2",1,5])

i=1
for i in range(len(t)):
    a = input(t[i][0])


if a == t[1]:
    print(t[2])

I made the code like this, but I don't know what to do. Please help me

python

2022-09-20 16:28

1 Answers

Homework by yourself

arr = (["3+2",5,3],["6/2",3,5],["10-2",8,3],["2's 3 wins",8,4],["5-2*2",1,5])
score = 0
great = 0
bad = 0
for i in arr:
    print(What is i[0] + "? :")
    n = int(input())
    if n == ?:
        great += 1
        score += ?
        print ("Correct!")
    else:
        print ("Wrong! Wrong")
        bad += 1
print("Correct answer:" + str(great) + "Wrong answer:" + str(bad) + "Score"


2022-09-20 16:28

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.