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.

## Recommended Answers

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 …``

## All 2 Replies

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

That fixed it! Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.