DBT Bureau
Bengaluru, 12 April 2025
Mathematics as a subject has multiple real-world applications. However, classroom teaching usually neglects this fact, leading to unintentional fear creeping into students’ minds. ‘Math for Fun’ is an attempt to motivate students and learners to embrace mathematics as a way of life as it is not only fun to learn but also has multitudes of real-world applications.
In this article, we will discuss how integers (yes, this is the beginning subject of mathematics) are used in the coding world. It is interesting note that Python programming language requires a strong foundation in integers. And Python is the bed rock of mastering AI (artificial intelligence).
Here are some of the examples:
1- How does a Robot walk?
Robotics have several uses of integers. For instance, simulate how a robot walks using integer steps.
# Walk forward 10 steps
for step in range(1, 11):
print(f”Step {step}: Robot moves forward”)
(Python)
2-Do you know image data uses integers to represent pixel values?
Image data uses integers. These integers typically fall within a range like 0 to 255. Here 0 represents black and 255 represents white.
image = [
[0, 255, 0],
[255, 0, 255],
[0, 255, 0]
]
for row in image:
print(row)
(Python)