Python 3


"The first Python course that simply amazed me. Very well explained and easy to understand." (Alexandru Cosmin)

"The best Python course in Romania." (Iulian Geană)

PAGE 1 / 5
Loops - Introduction
Home >>> Online Lessons, Python 3

Repetition Taken to the Extreme

Imagine if Pharaoh Khufu, through his engineers of that time, had told the slaves approximately 2,521,000 times:

linear sequence


They would have talked more, right?

There was a plan / algorithm well thought out for all the millions of people who worked to build The Great Pyramid of Giza over 20 years. A titanic effort for a remarkable result! As you can see, the algorithm was finite, even though it apparently took a long time. A technological wonder that still stands today.

We have seen it in movies or documentaries. Essentially, the sequence is much more complex, and no one knows all the exact steps...

Surely the "architect" stated that to build the pyramid, a volume of 2,521,000 m3 was required and estimated approximately 2,521,000 stone blocks, brought into position and then polished with incredible precision. Well, the home calculation does not match the market calculation, practically, but... approximately, it is remarkable.

So, to command the entire process, he probably expressed it as follows:

Repeat the linear sequence 2,521,000 times for each stone block.

It turned out to be a marvel of the World...

Embark on the journey to become an exceptional programmer! "Repetition is the mother of learning", ... and you must understand that to succeed, it takes a lot of work, perseverance, repetition, and passion to achieve remarkable things.

Loops in Python

In many cases, it is necessary for a set of instructions to be executed many more times.

How have we done it so far? We wrote the instructions as many times as needed. This is not an acceptable solution. Imagine that an instruction needs to be executed 100,000 times...

For this, there are repetitive instructions for and while in the Python programming language!
Proceed to the next page.
 home   list  CONTENTS   perm_identity   arrow_upward