0
I was to program a basic calculator (add, divide, multiply, divide absolutely, find the rest of the division and power).
The code is this :
operando_1=input()
operando=input()
operando_2=input()
resultado=None
if operando_1.isdigit():
operando_1=int(operando_1)
tipo_operando='int'
else:
operando_1=float(operando_1)
tipo_operando='float'
if operando_2.isdigit():
operando_2=int(operando_2)
tipo_operando='int'
else:
operando_2=float(operando_2)
tipo operando='float'
if operando=='+':
resultado=operando_1+operando_2
elif operando=='-':
resultado=operando_1-operando_2
elif operando=='*':
resultado=operando_1*operando_2
elif operando=='//':
if operando_2==0 or operando_2==0.0:
print('Falso.')
else:
resultado=operando_1//operando_2
elif operando=='%':
if operando_2==0 or operando_2==0.0:
print('Falso.')
else:
resultado=operando_1%operando_2
elif operando=='/':
if operando_2==0 or 2==0.0:
print('Falso')
else:
resultado=operando_1/operando_2
elif operando=='**':
resultado=operando_1**operando_2
if type(resultado)==float:
print(format(resultado,'.2f'))
elif type(resultado)==int:
print(resultado)
The mistake you’ve been making is this Syntax error: multiple statement found while compiling a single statement
.
The problems are:
1 - I don’t know if I am running the code correctly or the right way
2 - I have done everything on Otepad, I don’t know if there is a program that makes it easier to read and/or find errors.
Except for the typo on line 22, here it seemed to run normally.
– Woss