Python Tutorial for Beginners 7: Loops and Iterations – For/While Loops

///Python Tutorial for Beginners 7: Loops and Iterations – For/While Loops

Python Tutorial for Beginners 7: Loops and Iterations – For/While Loops

FavoriteLoadingAdd to favorites

In this Python Beginner Tutorial, we will begin learning about Loops and Iterations. Specifically, we will be looking at the for/while loops. We will learn about iteration and also how to break out of the loops using the break and continue keywords. Let’s get started.

The code from this video can be found at:

Watch the full Python Beginner Series here:

✅ Support My Channel Through Patreon:

✅ Become a Channel Member:

✅ One-Time Contribution Through PayPal:

✅ Cryptocurrency Donations:
Bitcoin Wallet – 3MPH8oY2EAgbLVy7RBMinwcBntggi7qeG3
Ethereum Wallet – 0x151649418616068fB46C3598083817101d3bCD33
Litecoin Wallet – MPvEBY5fxGkmPQgocfJbxP6EmTo5UUXMot

✅ Corey’s Public Amazon Wishlist

✅ Equipment I Use and Books I Recommend:

▶️ You Can Find Me On:
My Website –
My Second Channel –
Facebook –
Twitter –
Instagram –

#Python

source

By |2019-04-24T17:09:20+00:00April 24th, 2019|Python Video Tutorials|36 Comments

36 Comments

  1. ramesh jayaprakash April 24, 2019 at 5:09 pm - Reply

    Help me in getting this fixed:

    Question :
    We create two lists:
    subject = ["history", "Maths"]
    marks = [90, 80]

    How to assign marks to each subject and print them using for loop in python?

  2. vili vont April 24, 2019 at 5:09 pm - Reply

    Great tutorial! How to put timer on loop? If we want it to run for lets say one minute.

  3. Mateusz W April 24, 2019 at 5:09 pm - Reply

    Is this Atom? What theme is this?

  4. westfield90 April 24, 2019 at 5:09 pm - Reply

    I wish you you could spend a little more time on explaining the correct syntax a little more

  5. Leandro Silva April 24, 2019 at 5:09 pm - Reply

    Best explanation . Thank you.

  6. Kamal Debnath April 24, 2019 at 5:09 pm - Reply

    Excellent tutorial about python, I like all your video very much. Will wait for your tutorial regarding python popular packages like NumPy, Pandas, Scipy. Appreciate your effort

  7. Lexi April 24, 2019 at 5:09 pm - Reply

    Question: I can't understand the concept of range( len( ) ) during a for loop. What does that in simpler terms mean? Also, does the range function only take a sequence of numbers? My teacher wants us to be using range( len( ) ) during a for loop all the time and it confuses the heck out of me. I understand that len( ) is the length of a sequence or a collection but I dont get how that could be applied to looping through a range? Please help!

  8. Chengyao Zheng April 24, 2019 at 5:09 pm - Reply

    I want to know what IDE is this, looks so reliable and clean.

  9. Vivian Edwards April 24, 2019 at 5:09 pm - Reply

    Ctrl + C doesnt stop it, thats the copy shortcut for windows

  10. Catherine Duran April 24, 2019 at 5:09 pm - Reply

    I dont get how i pay 9000 dollars a semester when i learn from YouTube for free.

  11. Expry 24 April 24, 2019 at 5:09 pm - Reply

    Really good tutorials

  12. Stevedorez April 24, 2019 at 5:09 pm - Reply

    best explanation ever. thank you a lot.

  13. Kawaii Cookie April 24, 2019 at 5:09 pm - Reply

    very useful videos great for my computer science revision 🙂

  14. Ryan Ziems April 24, 2019 at 5:09 pm - Reply

    Great video, thank you very much!

  15. Oceans Blue April 24, 2019 at 5:09 pm - Reply

    Excellent and clear like Crystal. however, if i write like the under stated, it prints Eleven times, not too sure why

    loop = 0

    while loop < 1:

    print('Hello ')

    loop = loop + 0.1 # Notice i typed + 0.1 not + 1

    Your feedback is greatly appreciated.

  16. CallMeCups April 24, 2019 at 5:09 pm - Reply

    I enjoyed watching you video but I have a question. How can I use a While Loop infinitely with user input? Say I want to make a basic tax calculator that can be used infinitely until user inputs a zero, for example. Then and only then it will end the code.

  17. Myles Gmail April 24, 2019 at 5:09 pm - Reply

    I tweeted this

  18. kalangi prasad April 24, 2019 at 5:09 pm - Reply

    x=0
    while x<10:
    if x==5:
    break
    print(x)

    x=x+1

    # Output :- 0,1,2,3,4

    In the same way, if we use "continue" then.

    x=0
    while x<10:

    if x==5:

    continue
    print(x)

    x=x+1

    # Output :- 10, 11,12,13,14

    But in continue output should skip 15 and continue. But why do we get like this ??

  19. MH8792 April 24, 2019 at 5:09 pm - Reply

    مشكور ع الشرح

  20. GURSANGEET SINGH April 24, 2019 at 5:09 pm - Reply

    well explained

  21. Scott Wiseman April 24, 2019 at 5:09 pm - Reply

    I was in the loop 🙂

  22. Bon Bon April 24, 2019 at 5:09 pm - Reply

    What if I want to iterate over a range of FLOATS? :q
    Or if I want to do the first iteration unconditionally? (as the `do..while` loops work in C)
    Or maintain a couple of independent loop counters inside the same `for` loop? (it was totally possible in C)

  23. George Muirhead April 24, 2019 at 5:09 pm - Reply

    Gotta say love Sublime ! it's so customisable !

  24. Epic Man April 24, 2019 at 5:09 pm - Reply

    this was the best break down of the for loops for now, can you do one in python 3.7 on computer?

  25. Kris HEALTHCARE: AI April 24, 2019 at 5:09 pm - Reply

    Or rather than writing continue, just put nothing. Does the same thing…

  26. macro nature April 24, 2019 at 5:09 pm - Reply

    Great explanation , thanks

  27. The Legendary Zeke April 24, 2019 at 5:09 pm - Reply

    I hope this helps with my homework😁

  28. Samuel Paredes April 24, 2019 at 5:09 pm - Reply

    hey men, nice video, what is your text editor?

  29. MyOpinionIsAFACT April 24, 2019 at 5:09 pm - Reply

    So my teacher wants us to do some pointless shit in pseudocode and we have to learn all of these additional details –
    i have forgotten a key word often put below for loops and below the iterated code.
    for e =0 to 5 then
    <code>
    <keyword here>
    Any clue what it is? There's no such thing in python or any other programming language that i ever used so…. any idea?

  30. Naim Rahat April 24, 2019 at 5:09 pm - Reply

    I am still having confusion with while loop. Can you please explain the while loop more elaborately? @Corey Schafer

  31. Entity:Unknown April 24, 2019 at 5:09 pm - Reply

    Thank you – this was very helpful! 🙂

  32. Akshay Bhasin April 24, 2019 at 5:09 pm - Reply

    For the heck of it I made an endless loop to see what would happen, and control + C didn't work! My computer's fans kicked in after about 2 minutes and I was like "oops…", but then figured it out – on a Mac using PyCharm its ⌘ + F2 (Fn + 2)

  33. Freddie Wooten April 24, 2019 at 5:09 pm - Reply

    Great video! But how do you change a for loop to a while loop?

  34. Anatolii Kosiuha April 24, 2019 at 5:09 pm - Reply

    I cant stop my INFINITE LOOP by pressing ctrl+C

  35. kelsy w April 24, 2019 at 5:09 pm - Reply

    Thank you!!

  36. manar jbily April 24, 2019 at 5:09 pm - Reply

    Thank you for such a wonderful video on python learning ,I have question how do you put # in front of multiple line in one step?

Leave A Comment

*