Back to Lessons
BeginnerBasics

Division Basics

lesson_15.py
>>> ## Concept In Python, dividing numbers can be easily done using the forward slash `/`. This operation will give you the quotient of the division, which is the result of dividing one number by another. When you use the division operator, Python will return a float, even if the numbers divide evenly. Here's a simple example: ```python result = 20 / 4 print(result) # This will output 5.0 ``` In the above example, `20 / 4` performs a division, and the result is `5.0`. Notice that the result is a float. ## Practice Let's practice dividing numbers. Your task is to write a small piece of code that calculates the result of dividing 100 by 5 and then prints out the result. This will help you become comfortable with the division operation in Python. ### Starter Code ```python # TODO: Calculate 100 divided by 5 and print the result ``` ### Instructions 1. In the provided starter code, replace the comment with a calculation that divides 100 by 5. 2. Use the `print` function to display the result. ### Example: If you calculate 100 / 5, your result should be 20.0 and that's what you need to print. Once you make this change, your program should output `20.0`, which will pass the test case.
Code Editor

Sign in to submit your answer and earn XP.