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?
11 Antworten
+ 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.
+ 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")
+ 1
Can you post your code?
+ 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.
+ 1
pasem if you wish to just post the image in your feed. I'll take a look at it.
+ 1
THANKS SO MUCH it finaly work
0
Can i just send a photo? I am coding on computer and it will be hard to write it
0
Done,and sorry for bad quality
0
pasem what was the error?
0
pasem :D
0
Print without 0 divisible error check google