[Solved] Python programing – exiting the loop and displaying score [closed]


userWantToContinue = True
while aqpool[0] and userWantToContinue:
    shuffle (aqpool)
    numRight = 0

    for question, rightAnswer in aqpool:
        answer = raw_input(question + " ")

        if answer == rightAnswer:
            print ("RÄTT SVAR!")

            numRight = numRight + 1

        else:
            print("FEL SVAR! Rätta svaret är: " + rightAnswer + "\n")


        print("Vill du försätta spela? (ja eller nej)")
        userWantToContinue = str(raw_input()) not in ('n', 'nej')
        if not userWantToContinue:
            break

    total = numRight / len(aqpool) * 100
    print ("Du hade %s%% rätt!" % total)

7

solved Python programing – exiting the loop and displaying score [closed]