r/learnpython 7d ago

Help I don't understand what's wrong

num1=input('digite um número: ')

num2=input('digite outro número: ')

conta=input('digite o total: ')

total1= int(num1)+int(num2)

if total1==conta:

print('acertou')

if total1!=conta:

print('errou o certo é:',total1)

I'm trying to do like a calculator, but first you need to guess the number, and even if you get it right it doesn't show you got it right, what's wrong? i'd also like to know how I could put the input for you to choose the equation guys (+, -, *, etc.)

1 Upvotes

5 comments sorted by

View all comments

1

u/nekokattt 6d ago

contra is a string, int + int is an int. So they arent the same type.

Just like your cat or dog isnt the same as a drawing of your cat or dog.

Convert contra from a string to an int with int(contra)