okay, so ive tried to create a python maths quiz for my children to Improve their math skills but I cant figure out what is wrong with my code?
print ("what is your username")
name = input () .title()
print (name, "welcome")
import random
score=0
question=0
for i in range(10):
ops = ["+", "-", "*"]
num1 = random.randint (0,10)
num2 = random.randint (0,10)
oparator = random.choice(ops)
Q=(str(num1)+(oparator)+(str(num2)))
print (Q)
guess = input()
guess = int(guess)
if oparator =='+':
answer = ("num1+num2")
elif oparator =='-':
answer = ("num1-num2")
else:
oparator =='*'
answer = ("num1*num2")
if guess == (Q):
print ("correct")
score + 1
else:
print ("incorrect")
im not very skilled at programing and I am only starting to learn how to on a course. any help would be really greatly thanked :) my problem is that no matter what I do it will always say the answer in incorrect
Aucun commentaire:
Enregistrer un commentaire