For Loop vs While Loop: Which one is ACTUALLY faster in Python? (Speed Comparison)

Published: 06 September 2021
on channel: Indently
4,059
70

While this test script doesn't really give any basis for actually comparing the For Loop to the While Loop, it does help us with understanding that their are situations that the For Loop is much faster.

There are so many factors that can come into play when you're comparing these two in-built functions though. One is the compiler in your computer, the execution speed can change randomly based on what programmes your computer is running.

But also as a reminder, this video was more of a curiosity. Don't waste time on trying to save a few milliseconds by deciding which loop you should use. Just make sure you use For Loops for fixed iterations, and While Loops for potentially infinite iterations.


On this page of the site you can watch the video online For Loop vs While Loop: Which one is ACTUALLY faster in Python? (Speed Comparison) with a duration of hours minute second in good quality, which was uploaded by the user Indently 06 September 2021, share the link with friends and acquaintances, this video has already been watched 4,059 times on youtube and it was liked by 70 viewers. Enjoy your viewing!