Why the code produces this answer? [Python]
Question: Basically I'm setting up a code, but for some random reason it always says the
answers are wrong.

So, say it is '10 x 10' & I would say it is '100'

The code however says back to me, '**`I'm sorry the answer is 100`** '

**Why the code produces this answer?**

Here is the code:

P.S.: I know that I do not have to do '`Num_(NUMBER)`' for all of it!

    
    
    from random 
    import randint 
    import random
    
    correct = 0
    
    for i in range (3):
      num_1 = randint (1, 10)
      num_2 = randint (1, 10)
      prob1 = num_1*num_2
    
    print (“What’s %d x %d? “ (num_1, num_2))
    ans1 = input ()
    
    If ans1 == prob1:
      print (“That’s the correct answer!  /n”)
      correct = correct +1                                                             
    else:
      print (“No I’m afraid the answer is %d. /n” & (prob1))
    
    for n in range (3):
      num_3 = randint (1, 10)
      num_4 = randint (1, 10)
      prob2 = num_3+num_4
    
    print (“What’s %d + %d? “ (num_3, num_4))
    ans2 = input ()
    
    If ans2 == prob2:
      print (“That’s the correct answer!  /n”)
      correct = correct +1
    else:
      print (“No I’m afraid the answer is %d. /n” & (prob2))
    
    for m in range (4):
      num_5 = randint (1, 10)
      num_6 = randint (1, 10)
      prob3 = num_5 - num_6
    
    print (“What’s %d - %d? “ (num_5, num_6))
    ans3 = input ()
    
    If ans3 == prob3:
      print (“That’s the correct answer!  /n”)
      correct = correct +1
    else:                                                                                                                              
      print (“No I’m afraid the answer is %d. /n” & (prob3))
    
    print (“I asked you 10 questions, you got %d of them right. “ %(correct))
    exit()
    


Answer: the probe variable is an integer type. the answer that you get from the user
is a string. test it this with:

> print type(ans1)
>
> print type(prob1)

so you need to convert the input from the user to an integer:

> if int(ans1) == prob1

