course content

Course Content

Data Types in Python

Complicated MathComplicated Math

This section contains intriguing information; I trust you will find it engaging. You may have encountered mathematical operations such as // or %. In this section, we will delve into their explanations.

The operation // is called integer part division. It assists in determining how many whole instances of the right-hand number can be accommodated within the left-hand number. A common application of this operation is in scenarios where we wish to calculate the number of identical items we can purchase. For example, if we possess 38 dollars and intend to purchase multiple bottles of water, each priced at 7 dollars, we can calculate 38//7, yielding a result of 5. Thus, we can purchase 5 complete bottles.

The second operation, denoted as % and called the remainder, serves a similar purpose. In practical terms, the remainder can be likened to the concept of change. To illustrate this, let's revisit the bottles example. If we determine that with 38 dollars, we can purchase 5 bottles of water, the remainder reveals the amount of change remaining after we acquire the maximum possible quantity of items. In the same scenario, our change is calculated as 38 % 7, resulting in 3. Consequently, we have spent 35 dollars and retained 3 dollars as a change.


Imagine that you are a student at school and you have to solve 10 math tasks. You’ve noticed that the average time to handle each task is 7 minutes; however, you have 60 minutes total.

  1. Calculate how many tasks you can manage and assign the result to the completed variable.
  2. Calculate the number of minutes left and assign the result to the variable minutes.

Complete the task using the // and % operations, one operation for one task.

Everything was clear?

Section 1. Chapter 5
toggle bottom row