So erstellen Sie ein Mathe-Quiz mit Python [geschlossen]Python

Python-Programme
Anonymous
 So erstellen Sie ein Mathe-Quiz mit Python [geschlossen]

Post by Anonymous »

Ich möchte ein Mathe-Spiel erstellen, das etwa 5 Additionsfragen stellt und am Ende die Gesamtpunktzahl ausgibt und außerdem anzeigt, welche Antworten richtig und welche falsch sind. Ich habe das folgende Programm ausprobiert, erhalte jedoch nicht das richtige Ergebnis. Bitte helfen Sie mir.

Code: Select all

import random()
def askquestion():

score=0
num1=random.randint(1,20)
num2=random.randint(1,20)
correctanswer=num1+num2
answer=input(str(num1)+"+"+str(num2)+"=")
if answer==correctanswer:
print("great work!!")
score=score+10
else:
print("Uh-ohh! Let's try another one!")

askquestion()
askquestion()
askquestion()
askquestion()

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post