I am very new to python and I just created a program:

a = input('10x2= ')
if a==20:
    print ('Correct!')

if a!=20:
    print ('WRONG! Try again')


a = input('10x2= ')
if a==20:
    print ('Correct!')

if a!=20:
    print ('WRONG! Try again')


a = input('10x2= ')
if a==20:
    print ('Correct!')

if a!=20:
    print ('WRONG! Sorry, that was your last try... :( ')

The problem is that no matter what I enter when it asks for the input it says "Wrong! Try again
Like I said, I am very new to python and there is probably a very simple solution to this but I couldn't figure it out.

Ok , i can not tell you where is the problem .. but my code works and i can give you some suggestions :

a = int(input(" 10x2 = ? ")) // use of int function because you are looking just for int types (EX: numbers like 10 , 2 , 4 not 2.45 )

if a==20:
    print('Correct!') // result of if a = 20 
else: // else function , is better to use else instead of if not :D , that is a good practice 
    print('WRONG! Try again')
print('END OF PROGRAM') // this tells you that the program is ended without any errors 

Try this and tell us if it worked :D

Edited 3 Years Ago by MWEB

This question has already been answered. Start a new discussion instead.