Syntax error in basic calculator Python 3

0

I've been programming a basic calculator (adding, dividing, multiplying, dividing absolutely, finding 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 error you have given is this Syntax error: multiple statement found while compiling a single statement .

The problems are:

1 - I do not know if I'm running the code correctly or right way

2 - I have done everything in notepad, I do not know if it has any program that makes it easier to read and / or discover errors.

    
asked by anonymous 14.04.2018 / 15:33

2 answers

0

Everything seemed to run fine except for a syntax error on line 22. I just think the program is a bit confusing. And by answering question 2, for simple programs like this and for a quick edit I recommend the sublime text, later I could use an IDE or continue with sublime or any other.

Download the sublime: link

    
14.04.2018 / 18:02
0

1- In line 22, there is missing _ in type operand = 'float' The execution being or not by editor will be the same.

2- The error detection will be given in the terminal equally

    
14.04.2018 / 18:10