Loops: Use-cases and Examples | Python for Beginners Lesson 7 | Code with Kylie

Published: 23 May 2023
on channel: Kylie Ying
7,724
296

Watching this video to understand how we use loops in real-world programming.

In the previous lesson, we learned about for loops and while loops and how they world. However, what are the real-world applications of loops? Why would we want to use loops? Here are some examples.

At first, we dive into using a for loop to create related lists. If we have a list of numbers and we want to find the square of all those numbers, we can use a for loop to iterate over the original list.

Then, we look at using a for loop to iterate over numbers from 0 to n-1, using the range keyword.

Finally, we explore a use case of a while loop in order to find the base-2 log of some number n.

Timestamps:
00:00 Intro
00:14 Building Related Lists
05:12 Iterating Numbers
07:05 Looping over Indices
10:14 Implementing Log2

Feel free to leave any questions.

Please consider subscribing if you liked this video: https://www.youtube.com/c/ycubed?sub_...

Thanks for watching everyone!
~~~~~~~~~~~~~~~~~~~~~~~~
Follow me on Instagram:   / kylieyying  
Follow me on Twitter:   / kylieyying  
Check out my website: https://www.kylieying.com


Watch video Loops: Use-cases and Examples | Python for Beginners Lesson 7 | Code with Kylie online without registration, duration hours minute second in high quality. This video was added by user Kylie Ying 23 May 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 7,724 once and liked it 296 people.