M
M
Mirack2020-09-16 22:12:31
Python
Mirack, 2020-09-16 22:12:31

Why does Python give out “Division by 0!”, if by condition this should only happen when r==0, and I have r==10?

5f62629668ba2852355056.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
milssky, 2020-09-16
@milssky

Because you have multiple if blocks. In the first one, where you check for "/", everything works correctly. In the third, you have a bunch of elifs that don't work, but the else does, which just contains a message about division by zero. Solved by replacing 2 and 3 if with elif.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question