Skip to main content

Conquering Loops Together: A Beginner's Guide to Loops


Ditch copying and pasting code, there's a better way!

Hello there, coders! Today, we're diving into iterations (or loops), which are amazing and powerful tools to tackle repetitive tasks!

Understanding Loops

Iterations (also known as loops) are these functions that you use in programming to solve problems that take lots of repetition, or loops! 

Imagine writing 300 lines of code! That's horrible, but thankfully that isn't a thing due to loops being so efficient at doing repetitive things 

There are two types of loops that I know right now in Python, being the for loops and the while loops.



You know, loops are like those circular mazes where you have to keep going in circles until you reach the end.


While and for Loops

While loops are loops that keep executing the code over and over again until a certain condition is met. 

It's like a dog keeping a house safe, just like how the code after the loops can only be executed after the requirement is passed.

It's also similar to a dog, because if it never reaches the requirement, it'll continue forever (indefinite loops) like a dog chasing its tail until it becomes tired!

For loops are a bit more tame, repeating every time something is in a list of sorts.

They are a bit more complicated than the while loops but still easy nonetheless.

By the way, on a side note, I finally realized that Charles from the Python Course was also the one teaching on the videos besides from being the exercise teacher!

For the more technical readers out there, there are flowcharts that you can find online!

Conclusion

In conclusion, mastering how to use loops properly can save yourself from an inefficient mess of coding.

If you don't know, I'm also learning coding like you! 


By the way, there are a mountain of free resources online like books, videos and courses, and I definitely recommend researching for them.

Are there any other coding resources that you guys know? Let me and everyone else reading here know!


and with that,

signing out,
Stewie

Comments