0

Aldready fixed

I wrote a calculator using python and when i wrote If a or b == "0" Print("You cannot divide by zero") But then there was and error. Can anyone please help me?

12th Oct 2019, 2:26 PM
pasem
pasem - avatar
11 Respostas
+ 1
Inside the elif what == "/": before you divide the values check if a or b == 0 if you divide before you check of the numbers are 0 it will give you an error. And somehow end the program, idk how to do it on python.
12th Oct 2019, 2:37 PM
Odyel
Odyel - avatar
+ 3
There are several issues in this code: *If* and *Print* are written in upper case letters, also if statement is wrong, . should be like this: a,b = "0","0" if a == "0" or b == "0": print("You cannot divide by zero")
12th Oct 2019, 3:33 PM
Lothar
Lothar - avatar
+ 1
Can you post your code?
12th Oct 2019, 2:27 PM
Odyel
Odyel - avatar
+ 1
O, well unless there is a typo you forgot a colon at the end of the if statemtent. Change the "0" to 0 maybe thats it.
12th Oct 2019, 2:31 PM
Odyel
Odyel - avatar
+ 1
pasem if you wish to just post the image in your feed. I'll take a look at it.
12th Oct 2019, 2:31 PM
Aaron Stone
Aaron Stone - avatar
+ 1
THANKS SO MUCH it finaly work
12th Oct 2019, 2:45 PM
pasem
pasem - avatar
0
Can i just send a photo? I am coding on computer and it will be hard to write it
12th Oct 2019, 2:30 PM
pasem
pasem - avatar
0
Done,and sorry for bad quality
12th Oct 2019, 2:34 PM
pasem
pasem - avatar
0
pasem what was the error?
12th Oct 2019, 2:36 PM
Aaron Stone
Aaron Stone - avatar
0
12th Oct 2019, 2:46 PM
Odyel
Odyel - avatar
0
Print without 0 divisible error check google
13th Oct 2019, 7:08 PM
Akash Pawar
Akash Pawar - avatar