Lesson goal: Dividing by Zero

Previous: Programming as a calculator | Home | Next: Testing divisibility

You probably heard some strange words by your math teacher that you're not supposed to divide by zero. Also, there was probably some controversy in your class over what $\frac{0}{0}$ is equal to. Is this $1$? $0$? (It is neither.)

In this lesson, we'll experiment a little bit with these two oddities. By the way, to fully understand why you cannot divide by zero, you have to pay close attention in calculus class when you get to college. Even then, it can be a tricky concept.

In this lesson, we'll see what the computer says about dividing by zero and trying to compute $0/0$. Simply try two statements here. First, try having the computer divide by zero by enclosing some division by zero calculation in a print statement, perhaps print(4/0). What does the computer show? Next, try displaying the result of $\frac{0}{0}$.

Now you try. Use the print statement to see what the computer outputs for some number divided by $0$, and $\frac{0}{0}$.

Type your code here:

See your results here: