0

Make a quiz game to users,and at the end write total score of points(1 correct answer equals 1 point then calculate the end)

#my code:(My question is why doesent list score change permennatly when I typed print score+1 ) playing = input("Do you wanna play? ") print(playing) if playing.lower() != "yes": quit() print("Okay let us play ") score = 0 question_1 = input("What does cpu stand for? ") if question_1.lower() == "central proccesing unit": print("Your answer is correct") print(score + int(1)).append() else: print("Your answer is wrong") question_2 = input("What does gpu stand for? ") if question_2.lower() == 'graphics proccesing unit': print("Correct") else: print("Incorrect") question_3 = input("What Does Ram stand for? ") if question_3.lower() == "random acces memory": print("Correct") else: print("Incorrect") question_4 = input('What does psu stand for? ') if question_4.lower() == "power supply": print("Correct") else: print("Incorrect") #implement how many questions users got correct print(score)

12th Jun 2022, 5:29 PM
Nua
4 ответов
+ 4
Nua Đonaj , not clear what your issue or question is.
12th Jun 2022, 6:16 PM
Lothar
Lothar - avatar
+ 2
It would be better to test the code if you went to Code Playground, copy your code there, and then share it here. It's hard to debug a wall of text.
12th Jun 2022, 7:08 PM
Justice
Justice - avatar
+ 1
Nua Đonaj I did a basic layout showing simple syntax. You could avoid a lot of typing by using a function to print out the results, but hve fun with this first #my code:(My question is why doesent list score change permennatly when I typed print score+1 ) print("Multiple choice quiz\n"+"~"*20) score = 0 q1 = """What does CPU stand for? a. Classified Personal Union b. Central Processing Unit c. Colour Printing Underway """ print(q1) a1 = input().lower() if a1 == 'b': print("\nYour answer is correct") score +=1 print(f"Your score -> {score}") else: print("Your answer is wrong")
13th Jun 2022, 1:33 AM
Rik Wittkopp
Rik Wittkopp - avatar
0
Okay so I want to calculate 1 point for each correct score .So the one who enters inputs can see how many points they got. 1 correct question = 1 point more to score I tried adding 1 to score but it only shows 1 for that question then goes back to 0 How can I calculate number of points based on correct andwers!
12th Jun 2022, 6:41 PM
Nua