+ 1

What is wrong with my code?

elif user=='dividir': num1=float(input('digite o primeiro numero\n')) num2=float(input('digite o segundo numero\n')) if num2==0: while num2==0: num2=float(input('segundo numero digitado e invalido, por favor repetir\n') else: resp=num1/num2 print('resultado: '+str(resp)) when i run this code returns an error that says: syntax error else

26th Dec 2016, 1:16 PM
João Orlando
João Orlando - avatar
4 Antworten
+ 2
')' symbol is missing in the line: "num2=float(input('segundo numero digitado e invalido, por favor repetir\n')" It has two opening parentheses, but only one closing parentheses. If you just add another one at the end of the line, that should fix the problem.
26th Dec 2016, 4:59 PM
Dmitry Zolnikov
Dmitry Zolnikov - avatar
+ 1
that part of my code is to prevent the algorithym tô divide by zero
26th Dec 2016, 2:08 PM
João Orlando
João Orlando - avatar
+ 1
thank you
26th Dec 2016, 5:45 PM
João Orlando
João Orlando - avatar
- 2
Plz play meebo plz and thx
26th Dec 2016, 6:35 PM
hackingmaster
hackingmaster  - avatar