Im trying to build a calculator and im stuck in the beginning. I’ve written this, idk if how wrong is it:
pergunta1 = input (‘Selecione o número da operação desejada? 1/2/3/4 1: Soma / 2: Subtração / 3: Divisão / 4: Multiplicação’)
Numum = int(input(‘Primeiro número? ‘))
Numdois = int(input(‘Segundo número? ‘))
Resultado = 0
if pergunta1 == ‘1’:
Numum – Numdois = Resultado
print(Resultado)
and backs this:
File “C:UsersvinieAppDataLocalTempipykernel_265641627187640.py”, line 9
numum + numdois = Resultado
^
SyntaxError: cannot assign to operator
i though the problem was with the fact im trying to do a math with a varable thats in “string format” per say. So i put i try to declarate “Int” in it, but it didnt work
Vinicius Abude is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.