jeudi 1 octobre 2015

Pyton random math task (code integer message) Help cant figure out error (newb)

HI programing task stuck first time posting question so asking internet completely confused

#Programing Task  - A453

    import random
    import operator

    operators={"+":operator.add,
               "-":operator.sub,
               "X":operator.mul}

    name = input(" What is Your Name ? :")
    score = 0
    counter = 1

    for question in range(0,10):
        num1 = random.randint(1,13)
        num2 = random.randint(1,13)
        ranop = random.choice(operators)
        anwser = operators.get(ranop,num1,num2)#operator searches in operators(DICTIONARY) for random operator and then use num1 and num2 to create a question
        print("{0} {1} {2}=".format(num1,ranop,num2))
        if guess==anwser:
              print("✔")
        else:
            print("✘,The awanser was {0}".format(anwser))
    print ("{0}, You Finished! You got {1}/10".format(name.title(),score))

cant find error struggling please help D: Ik probably newb mistake but really need help




Aucun commentaire:

Enregistrer un commentaire