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

Sdílet
Vložit
  • čas přidán 5. 07. 2024
  • 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:
    github.com/CoreyMSchafer/code...
    Watch the full Python Beginner Series here:
    • Python Programming Beg...
    ✅ Support My Channel Through Patreon:
    / coreyms
    ✅ Become a Channel Member:
    / @coreyms
    ✅ One-Time Contribution Through PayPal:
    goo.gl/649HFY
    ✅ Cryptocurrency Donations:
    Bitcoin Wallet - 3MPH8oY2EAgbLVy7RBMinwcBntggi7qeG3
    Ethereum Wallet - 0x151649418616068fB46C3598083817101d3bCD33
    Litecoin Wallet - MPvEBY5fxGkmPQgocfJbxP6EmTo5UUXMot
    ✅ Corey's Public Amazon Wishlist
    a.co/inIyro1
    ✅ Equipment I Use and Books I Recommend:
    www.amazon.com/shop/coreyschafer
    ▶️ You Can Find Me On:
    My Website - coreyms.com/
    My Second Channel - / coreymschafer
    Facebook - / coreymschafer
    Twitter - / coreymschafer
    Instagram - / coreymschafer
    #Python

Komentáře • 506

  • @choudhrysaab
    @choudhrysaab Před měsícem +6

    I've been studying python coding for a while (on and off) and until a couple of days ago I had never heard of you. Like I said, I've looked a lot of material throughout various websites when it comes to Python learning so I'm surprised I had never known your CZcams channel. I came across your name while going through my Reddit feed and someone had asked a question who is the best Python tutor and your name was on top of the list with an excessive amount of upvotes and after looking you up I can definitely see why that was the case. Your videos are short and to the point and explained in the most simplest of terms; making them easy to grasp and not leaving anyone dumbfounded. Thank you so much providing these videos as they're helping immensely.

  • @imdadood5705
    @imdadood5705 Před 4 lety +71

    I don’t skip ad that comes in your videos. I don’t know if you get paid if we don’t skip ads. That is the least I can do for now. I am definitely donating, once I get a job in my field. Thank you for this Corey. It is truly amazing!

  • @ssss54
    @ssss54 Před 4 lety +135

    Corey I don't think I have come across a better Python training material than this. It is just too good and explains in detail about the concepts with good examples.

  • @moz658
    @moz658 Před 5 lety +88

    I've tried many tutorials explaining while and for loops on youtube. This guy is by far the best tutor explaining them very clearly.

  • @riteshsingh118
    @riteshsingh118 Před 7 lety +310

    I wonder, who the one hell has given the thumbs down for such a beautiful video on python learning!!

    • @ali-rizatoprak7296
      @ali-rizatoprak7296 Před 7 lety +3

      I guess who doesn't like python. :D from one big like.

    • @ShivamJha00
      @ShivamJha00 Před 6 lety +1

      Add me in the list.. Python is the most horrible language. C++ (or all other C-like languages) are far more better and conceptual

    • @iamthebull5SH
      @iamthebull5SH Před 6 lety +3

      Maybe because he ran an infinite loop and told us that the way to stop an infinite loop on most operating systems (by the way, a majority of the operating systems in use today are Windows operating systems) is to press Ctrl + C, but in most Windows environments, Ctrl + C is used for copying objects. TL;DR: False information

    • @ShivamJha00
      @ShivamJha00 Před 6 lety

      Ryan Nordquist nope. Linux is far more better than that shitty windows. And world is moving towards it..

    • @saurabh75prakash
      @saurabh75prakash Před 5 lety +1

      @Tech store, C++ is the most horrible(read complex) language. Google it.

  • @sechvnnull1524
    @sechvnnull1524 Před 4 lety +11

    Awesome job! I can tell you that as someone who has taken programming as part of my degree in college you do an amazing job at explaining things. Crystal clear. Thank you for this content and the hard work you put into this series. This is helping me immensely!

  • @mayankchawda2405
    @mayankchawda2405 Před 4 lety +7

    These are hands-down the best tutorials for python I have ever seen.
    Keep doing the amazing work.

  • @Warfalcon
    @Warfalcon Před rokem +9

    Your examples you provide are so much more helpful then the very basic "here is a for loop" explanation. You go one extra step to provide a more real world use, which is much more helpful for me. Thank you!

  • @luismartindelcampo9510
    @luismartindelcampo9510 Před 7 lety +62

    Hello Corey, a few days ago I was stuck trying to understand how to work with files from a python book I'm reading, so I decided to look for other resources, and that's how I found your video tutorials. I really like how you explain things, I see that you put an effort for us to understand the concepts and not just memorize stuff.
    I appreciate you took the time to make this videos since they have been a great learning resource for me. Keep up the good work!
    Saludos desde Mexico!

    • @coreyms
      @coreyms  Před 7 lety +4

      Glad to hear you found the videos useful!

  • @yanggao4878
    @yanggao4878 Před 6 lety +5

    Corey your tutorial vids are the most elegant and well-paced among all the vids that I have been trying to follow. Thanks a lot and keep up the great work :)

  • @balapaudel
    @balapaudel Před 6 lety +9

    Finally a clear understanding of While Loop. Thank you Corey.

  • @tjsmith2521
    @tjsmith2521 Před rokem +3

    Wow! You are the first person I've came across on the internet who has explained this so well! Thank you Corey!!! I'm a math fanatic and I wanted to learn iterations and loops so badly for my own sake but apparently no one explained well enough how to make the infinite loop stop without pressing ctrl C, as they didn't know how to explain well enough.

  • @rathorrath401
    @rathorrath401 Před 4 lety +2

    Man, Thank you so much. Your videos are the only ones that explain it in such a detailed, yet approachable manner. I've learned more by watching your videos than any other resource out there.
    Again. Thank you. If you ever have a bootcamp, let me know. lol

  • @timotheospetros
    @timotheospetros Před 5 lety +6

    Best Python tutorials I've ever seen on CZcams. Organisation of material, clarity of presentation, pacing of instruction all 10/10. I do online tutoring myself, so I'm very conscious of these requirements.

  • @comfyaura
    @comfyaura Před 2 lety +1

    Wow this was so simple. I have been reading articles, the textbooks, and attending lecture, but this was just, straightfoward. Wow. You have amazing teaching and explanation skills.

  • @pandrakaushik
    @pandrakaushik Před 5 lety +1

    Hey Corey. You're absolutely amazing. A clear and slick way of understanding anything in your tutorials. It would be a great help if you give out various examples and explain them. Like the whole program itself involving all the elements from previous videos. Thanks a lot. You're educating thousands for free.

  • @evamakri9694
    @evamakri9694 Před 9 měsíci +1

    Honestly speaking (because I've struggled a lot) , there is no loop video that tops yours! You say just what needs to be said to grasp the general idea! Thanks man, you are the best! I will absolutely watch your content!

  • @catherinearmagost8574
    @catherinearmagost8574 Před 5 lety +565

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

    • @coreyms
      @coreyms  Před 5 lety +95

      Feel free to share with your classmates :)

    • @catherinearmagost8574
      @catherinearmagost8574 Před 5 lety +6

      @@coreyms do you know how to make a loop where it ask an user input production per day and increases 1 day in the question, for example ("Enter production at day 1) then each time it ask it changes to 2,3,4,5. Is this possible?

    • @abdulmalikbalogun2572
      @abdulmalikbalogun2572 Před 4 lety +10

      If you haven't found out yet, here's a possible solution. Make a file with "1" in it. Then make a python program that reads the file, uses the number in the file, and then when it is done it overwrites the file by making the number larger by adding the number one to it.

    • @davidbrown2806
      @davidbrown2806 Před 4 lety +30

      Its the piece of paper that is worth the $9000 ..... lol

    • @DreaminBig
      @DreaminBig Před 4 lety +1

      I know right!!

  • @user-fx6xk8wo5f
    @user-fx6xk8wo5f Před 2 lety +1

    love this guy. talks business, no unnecessary words. it really saves time

  • @hardik12361
    @hardik12361 Před 6 lety +111

    I tried to learn programming quite a few time and quit countless times... you are the one with whom i actually i made it as far as this video..been here since python tutorial for beginners 1 ...and plan to complete and rock like you do :) ....keep it up bro... great work ...much love

    • @voke4553
      @voke4553 Před 3 lety +3

      How’d it go

    • @flocela
      @flocela Před 3 lety +2

      I'm happy for you, Han! : )

    • @Justin-ky1cr
      @Justin-ky1cr Před 3 lety +1

      Update please

    • @hardik12361
      @hardik12361 Před 3 lety +13

      @@Justin-ky1cr Almost done with django, i wrote some silly programs for my friends business and they liked it...learning more and more as i go on

    • @hardik12361
      @hardik12361 Před 3 lety +9

      @@voke4553 Explanation is so easy, i actually learn concepts from here. Still i do have to visit old videos sometimes for refreshing my memory :)

  • @niroshilawinjeya2409
    @niroshilawinjeya2409 Před 5 lety +3

    I dint understand the loops clearly until i watch this video...Thank you so much sir..you are the best python teacher on You Tube :)

  • @abdurrahmanpm97
    @abdurrahmanpm97 Před 6 lety +1

    Your tutorials are amazing. Please make more of these tutorials. I am going through all of your videos.

  • @test42356y
    @test42356y Před 7 lety +4

    Awesome tutorials. Tried learning with the "Learn Python the Hard way" book, but you explain concepts far more succinctly and clearly. Kudos

  • @xcrazysunshine
    @xcrazysunshine Před rokem +3

    I have been struggling SO hard with loops in my Intro to Programming class and this helps so much. Thank you!

    • @easydatascience2508
      @easydatascience2508 Před rokem

      You can see mine too. The channel has Python crash course tutorials, with detailed code files downloadable. The channel has another playlist, R beginning course.

  • @charlottejoytrudgill1690
    @charlottejoytrudgill1690 Před 4 lety +2

    This is a great explanation of loops! Structured and clear. Thank you!

  • @petemonique1494
    @petemonique1494 Před 4 lety +1

    Thank you for making this video, i'm currently going through python in easy steps and was stuck on loops. You explain things so clearly :)

  • @vigilantea6822
    @vigilantea6822 Před 6 lety

    Thank you so much for this video, I have only recently began to study python and every has been a breeze until I got to loops. The teacher I had unfortunately didn't explain them well for me but I understand them way more thanks to this video. Much appreciated dude

  • @federicovazquez9011
    @federicovazquez9011 Před 5 lety +12

    This seems to help explain my confusion with loops. Loops are there to help us write out steps out in a simple manner rather than typing out consecutive steps.
    With for loops, it’s for a definite number of times 1-5
    But with while loops it can go on forever

  • @skeppy8925
    @skeppy8925 Před 3 lety

    Great tutorial! I’ve been having issues understanding loops, and your video gave a nice/short description of the basics of them. Thanks!

  • @JusBlaze1028
    @JusBlaze1028 Před 2 lety

    I'm taking a Python course right now for school & you definitely cleared up some confusion I had with for & while loops (I was over-thinking it too much smh). Thank you for breaking it down for myself & other CZcams subscribers!

  • @rc_woshimao957
    @rc_woshimao957 Před 3 lety

    As a Python novice, I am really really thankful of this video!!!! I was looking at the free linked in class and it was so confusing. You are lifesaving. Thank you so much!!!! Happy new year!!!

  • @story_time007
    @story_time007 Před 4 lety +1

    I actually got a clearer explanation from this video. Thanks for this. A million thumbs up from me.

  • @BestDoDo
    @BestDoDo Před 3 lety +1

    Corey thank you, you are such a wonderful teacher. Comparing to others, you explain very easily.

  • @nehat786
    @nehat786 Před 6 lety +2

    No question brother. You explained so well. Love you!

  • @oluwasegunajayi8011
    @oluwasegunajayi8011 Před 3 lety

    Mr Schafer, you're actually doing a great job 👍💪. Totally simplified, impressive!

  • @timgore829
    @timgore829 Před 4 lety

    An excellent explanation of "for / while" loops within Python 3! Thanks.

  • @d1ntz9s
    @d1ntz9s Před 3 lety

    Corey, thank you! This tutorial showed me how to fix a problem I was having with an assignment.

  • @harneshsharma3141
    @harneshsharma3141 Před 2 lety

    You are simply awesome. I can understand every bit of what you cover in your videos. Though I don't have any programming background, I thoroughly enjoy watching your videos. I'm confident now that I can learn python. Thanks!!

  • @yiiuu3
    @yiiuu3 Před 6 lety +2

    Thanks! your video tutorials is what i used as a video referrence to the book called 'lean python-learn just enough python..' really helpful.

  • @soumyazyx
    @soumyazyx Před 4 lety +1

    Thank you Corey for your time and effort. Keep spreading the knowledge.

  • @renegranit240
    @renegranit240 Před rokem

    your videos are so unbelievably good. The things i dont unterstand in a whole schoolyear i learn in a couple days from your videos

  • @AdityaKumar-ox3wz
    @AdityaKumar-ox3wz Před 6 lety +18

    I was afraid of programming languages but you came out as a Saviour.Thanks ,Sir.

    • @sukriti2415
      @sukriti2415 Před 7 měsíci +1

      what u doing now got job or something?

    • @joshuaoffman920
      @joshuaoffman920 Před 3 měsíci

      was about to ask lol
      @@sukriti2415

  • @chaimwuensch7199
    @chaimwuensch7199 Před 2 lety +1

    really helpful, you did a great job explaining the different loops too, thank you!

  • @ExcelTutorials1
    @ExcelTutorials1 Před rokem

    Love the way that you explained this, I finally feel like this is starting to click. Thank you!

  • @vijivenkatprananya3629
    @vijivenkatprananya3629 Před 4 lety +1

    You are the one who made me pursue coding as a passion.

  • @FamFitFun
    @FamFitFun Před 4 lety +1

    its lockdown day 10 : making use of time to learn Python again ..@Corey Schafer is only Hope after exploring more than dozen courses.

  • @dannyc.2795
    @dannyc.2795 Před 7 lety +70

    love your vids Corey. One minor suggestion would be to increase the font size in your IDLE. Would make it alot easier to view on different devices.

  • @chumbo
    @chumbo Před 4 lety

    Thanks! I had to go through quite a few other instructionals before I finally understood it with your video! Well done, congrats! Teaching code to newbies is not an easy task ;-)

  • @akagami2128
    @akagami2128 Před 4 lety +3

    finally I understood looping in python. u the man.

  • @mahshidpooladvand8502
    @mahshidpooladvand8502 Před 5 měsíci

    The best explanation of loops and iterations!
    Thanks Corey joon!

  • @raresdammon
    @raresdammon Před 2 lety

    Best Python tutorials out there, hands down!

  • @yahiaessam2248
    @yahiaessam2248 Před 4 lety +2

    dude you and your videos are pure gold

  • @alwalid9547
    @alwalid9547 Před 6 lety +2

    your videos are always the best. you are GREAT Corey

  • @ancienttimesband2012
    @ancienttimesband2012 Před 3 lety

    The way you teach is amazing.! Thank you so much for uploading these videos. Im subbing!

  • @akashp4863
    @akashp4863 Před 4 lety +2

    You are a Gem amongst mentors

  • @glamify524
    @glamify524 Před 2 lety

    Another awesome breakdown. Very simple and easy to follow

  • @bhuvanmanocha903
    @bhuvanmanocha903 Před 4 lety +1

    Really nice explanation on this concept of loops! Thank you!!

  • @patrickwheeler1979
    @patrickwheeler1979 Před 9 měsíci

    Good stuff, just got done with Pandas a few weeks back and now I am filling in some gaps. Thanks for this wonderful content

  • @benwang6659
    @benwang6659 Před 2 lety

    Fell very easy to understand and I will follow it.Thanks

  • @WIFEYLADIE
    @WIFEYLADIE Před 2 lety

    Definitely helped my understanding. Thank you. This is much appreciated

  • @RicherTV
    @RicherTV Před 5 lety +6

    Thank you! I had been stuck as my list was counting downwards.

  • @rannicholas6730
    @rannicholas6730 Před 4 lety +1

    A great tutorial, hope to see more video tutorials about different statements in python.

  • @trinib1
    @trinib1 Před 3 lety

    this is the best python learning channel on CZcams..

  • @abdalmjeedmjody1923
    @abdalmjeedmjody1923 Před 4 lety +3

    good job, clear and smoothy .. thank you in infinite loop

  • @tusharahuja2155
    @tusharahuja2155 Před 6 lety +1

    i really appreciate ur knowledge BRO!!! hats off for you.

  • @tulikamal
    @tulikamal Před 5 lety +2

    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

  • @MattWatsonHarmonica
    @MattWatsonHarmonica Před rokem

    While loops have always been confusing to me. Thank you for clearing this up!

  • @She_cooks2023
    @She_cooks2023 Před rokem

    Loving the series!

  • @bettaexp
    @bettaexp Před 2 lety

    I never "like, comment, and subscribe" but I'm learning Python and I was hard stuck trying to figure out why my loops weren't working and turns out they key was the 'continue' command that I didn't know about. Thank you so much!

  • @ronithNR
    @ronithNR Před 7 lety

    Hey, i really loved your videos very much it's very interesting and you teach in a very understandable way for anyone with non-computers background.
    I would really love that you did videos of Machine learning in python as it will be useful for most people like me i'm a beginner in data analytics using R software and now i'm interested in learning python for data science and bit automation.

  • @leynahoang3141
    @leynahoang3141 Před 2 lety

    thanks for creating this video. reviewing for my comp sci midterm

  • @maximillianramirez1189
    @maximillianramirez1189 Před rokem +1

    Your videos are so easy to follow 👍

  • @FarizDarari
    @FarizDarari Před 4 lety +2

    Great overview of Py loops!

  • @heshankumarasinghe3159

    I learnt new things..... Thank you for uploading these videos.....

  • @ram_qr
    @ram_qr Před rokem

    so clear and brilliant explanation

  • @monagulapa3022
    @monagulapa3022 Před 4 lety +1

    Amazing Corey ! 👍

  • @colourburstartist7453
    @colourburstartist7453 Před 5 lety +2

    very useful videos great for my computer science revision :)

  • @guilhemlinde
    @guilhemlinde Před 5 lety +2

    amazing to have such good content for free.

  • @AllAboutDubaiLife
    @AllAboutDubaiLife Před 3 lety

    i guess i am gonna pass this semester with the help of your videos. Because all my courses like artificial intelligence and digital image processing need python and thank you for clearing my concepts.

  • @WatashitachiEien
    @WatashitachiEien Před 6 lety

    You're very good teacher, thankyou so much.

  • @adimizrahi24
    @adimizrahi24 Před 2 lety

    that so F**ing easy now damn ive try do understend that for 2 days and here u come with a damn 11 min video and now i can explain it OMG i was so frusterated!!! ty so much man

  • @bhuvaneswarisiva2000
    @bhuvaneswarisiva2000 Před 6 lety +1

    your explanations are fantastic

  • @meltedcheese1908
    @meltedcheese1908 Před 6 lety

    Very helpful mate, great video!

  • @doangmawar8716
    @doangmawar8716 Před 4 lety +1

    Very very clear explanation, thanks sir.

  • @benderbendingrofriguez3300
    @benderbendingrofriguez3300 Před 4 lety +15

    for x in range (1,1000):
    print(' LOVE THIS VIDEO')

  • @danielfry5234
    @danielfry5234 Před rokem +1

    I like your style Corey :) many thanks

  • @ashlinmathew7345
    @ashlinmathew7345 Před 5 lety +1

    thank you so much!!this was extremely useful:)

  • @raashed
    @raashed Před 8 měsíci

    even after these many years his videos are still intresting 🙌

  • @igboerikauzoma4127
    @igboerikauzoma4127 Před 4 měsíci +1

    your tutorials are the best!!

  • @LeandroSilva-qq7yb
    @LeandroSilva-qq7yb Před 5 lety +1

    Best explanation . Thank you.

  • @sritejavavilala8976
    @sritejavavilala8976 Před 2 lety

    This channel deserves more subs

  • @abdulrazaqbature1523
    @abdulrazaqbature1523 Před 4 lety +1

    i really admire your explanation, you are great

  • @rajivjani8594
    @rajivjani8594 Před rokem

    Super! Thank you for sharing!

  • @bumblee_beee
    @bumblee_beee Před rokem

    👍best video with clear and neat explaination

  • @took_ya_handle
    @took_ya_handle Před 4 lety +1

    great explanations - thank you!

  • @aminehatunozturk3171
    @aminehatunozturk3171 Před 3 lety +2

    You have a clear English so I can understand it easily.

  • @accountdeleted6301
    @accountdeleted6301 Před 5 lety +2

    Best version of python for programmers and beginners for self study.

    • @haileyr2264
      @haileyr2264 Před 4 lety

      Guleid Muhuyadin and for college students
      I don’t understand the material in my class but this helped me so much hahaha

  • @RandomShowerThoughts
    @RandomShowerThoughts Před 5 lety +1

    All we need is a time and space complexity and this playlist would be complete!

  • @babytoyplaysongs8852
    @babytoyplaysongs8852 Před 5 lety +1

    Great explanation , thanks

  • @OliverGomes
    @OliverGomes Před 6 lety

    You are Awesome Corey !!! Thanks a lot :D