Zerodivisionerror error in Python
Hi, I performed this code but it did. What is the reason? How should I make it?
a = 10
b = 0
print(a / b)
ZeroDivisionError: division by zero
Hi, I performed this code but it did. What is the reason? How should I make it?
a = 10
b = 0
print(a / b)
ZeroDivisionError: division by zero
In mathematics, no number is divisible by 0
Because this method is not defined
Because for the system and ... the number is not defined by zero.
The reason for the error is divided by zero. To avoid this erro, you should check thatbNot zero. Modified code:
a = 10
b = 0
if b != 0:
print(a / b)
else:
print("Cannot divide by zero")
Hi. The reason for this Error is that you are trying to divide a division by zero, for example, if I write 5 divided by 0 this Error because it cannot be divided by 5 by 0
The number is not divisible by 0.
Either change 0 or request a number from the user.
Or ask him to answer while b != 0 until he enters 0
This error is an example of exception error
which you can do with try:
except:
Do it and show any error example that your code wants in the except section
Hi Python does not divide any numbers by 0 you encounter a Division Zero error error
If you are just going to print numbers you should use: (A, B) Print Dear friend
Because it won't be divided by zero if zero is made.
This error means you are dividing a number by zero !!!!
This cannot be done because it is one of the defined in mathematics.
No zero numbers are divided, change that number.
Don't divide 10 by 0, divide it by 5. It's correct. You can't divide 10 by 0 at all
Submitting answers is currently unavailable.
You must be logged in to access this section.
Login/Sign up If you don’t understand the exercise or can’t solve it for any reason, that’s completely
normal—don’t worry 😊
Try checking out easier exercises and reviewing different answers
submitted by others. Gradually, you can move on to more challenging exercises. Also, your answer
might be correct even if it’s different from others.