CodeSolved

Solved Programming Questions & Exercises

Zerodivisionerror error in Python

Technical question 2039/ Download 876 Views

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

10 Answers

In mathematics, no number is divisible by 0
Because this method is not defined

Sumy.amiri Download

Because for the system and ... the number is not defined by zero.

User 1496 Download

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")
Ai Download Python

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

Aryanmim.asp.mac Download

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

Thebutcher Download

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

User 6713 Download

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

Anonymous Download Python

Because it won't be divided by zero if zero is made.

User 4141 Download

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.

Mohammad.mahdi88 Download

Don't divide 10 by 0, divide it by 5. It's correct. You can't divide 10 by 0 at all

Amirr Download

Submit answer

Submitting answers is currently unavailable.

×
×
Close