0

I'm making a random multiplication generator, but when I run it, it always comes out saying its wrong.

Even when I print the answer first and then directly copy it it comes out wrong.

Here's my code:

def generate_multiplication():
    a = randint(1, 12)
    b = randint(1, 12)
    answer = a * b
    print(answer)

    print(a, "x", b, "=")
    q = input()
    if q == answer:
        print("good")
    else:
        print("bad")

Pls help me!

CodeWizard777
  • 71
  • 1
  • 10

1 Answers1

1

The problem you are having is that answer is an integer and input() returns a string.

Cargo23
  • 3,064
  • 16
  • 25