Python Tutorial 13: Understanding Python While Loops

  Рет қаралды 20,015

Paul McWhorter

Paul McWhorter

3 жыл бұрын

You guys can help me out over at Patreon, and that will help me keep my gear updated, and help me keep this quality content coming:
/ paulmcwhorter
In this video we show step-by-step instructions on how to understand and use python while loops. I do not assume you are an expert, so these lessons are designed for complete beginners.
#Python
#Lessons
#Programming

Пікірлер: 232
@chethantb500
@chethantb500 3 жыл бұрын
I did watch your Ardiuno , Raspberry Pi, and little bit AI on Jetson series... Being Electronics student everything what you are doing is helping me a lot... Even I did my college project using your series..."Attendance system using face recognition on Raspberry Pi".....indeed yor are lifting us up.. Huge respect towards you sir Thanks a lot....🤩
@pauivorra1819
@pauivorra1819 3 жыл бұрын
I am legend, despite this homework was easier than other ones.
@kck.Schrodinger13
@kck.Schrodinger13 2 жыл бұрын
I AM FINALLY LEGEND after a losing streak! Having so much fun with these lessons.
@paulmcwhorter
@paulmcwhorter 2 жыл бұрын
Nice work!
@amayaphotos8016
@amayaphotos8016 Жыл бұрын
I AM A LEGEND I got this one correct & yeah it was a bit easy.Got to mention that your homework assignments are really helpful. Thank you for sharing your knowledge with us
@opalprestonshirley1700
@opalprestonshirley1700 3 жыл бұрын
Got it, Paul, I am legend. Enjoyed the lesson. Looking forward to reading and writing files. Have a great week.
@johnplowright6421
@johnplowright6421 2 жыл бұрын
I just wanted to add, I am really enjoying these lessons, with the tools you have given so far, I wrote my own little program to collect and sort two data sets for a string input and then an associated value in no particular order until the user types exit, then it sorts the data by the value and re-orders both data sets to finally print the string against its value from highest to lowest. Of course I made mistakes but the joy of fixing these and seeing the program do what you wanted it to do is great.
@sudhanshupawar8760
@sudhanshupawar8760 2 жыл бұрын
i used to hate programming before i started watching your tutorials...you really make programming fun
@MrElFRanz
@MrElFRanz 3 жыл бұрын
Hello Paul, I completed the while homework, this one was easier than the last one, for which I needed hours. I could do the while homework in minutes. Thanks for your marvellous lessons.
@426F6F
@426F6F 8 ай бұрын
I got my while loop to print the index from the beginning to the end of the array, and then print from the end back to the beginning! Counting backward requires a bit of manipulating the variables and changing the addition operator, but it was pretty simple. Another awesome lesson Paul!
@OzdemirCem
@OzdemirCem 3 жыл бұрын
Paul's words are really understandable. Congratulations. Doing homework is very important. The code is not written without encountering the problem.
@mohsenr4434
@mohsenr4434 2 жыл бұрын
I did the homework and debugged it on my own. Good lesson as always, thanks.
@pralaymajumdar1206
@pralaymajumdar1206 3 жыл бұрын
Very knowledgeable and inspirational lecture... Thank you sir and waiting for the next week.
@cbrombaugh
@cbrombaugh 3 жыл бұрын
I AM LEGEND! it seemed easier than the for exercises. Looking forward to catching up to current lesson. Again, thanks for the most excellent courses, Paul.
@paulmcwhorter
@paulmcwhorter 3 жыл бұрын
You're very welcome!
@dawidstawowy6474
@dawidstawowy6474 2 жыл бұрын
I'm legend. It took me 2 minutes to figure out this homework, probably because previous one took me 6 hours, but I couldn't even imagine that i'm folding up like a cheap Walmart chair!. Thank You unce Paul for this incredible new tutorial series!
@paulmcwhorter
@paulmcwhorter 2 жыл бұрын
Nice job!
@martinlewis645
@martinlewis645 2 жыл бұрын
I'm back after a nice Spring/Summer break and I Am Legend! Thank you Paul.
@paulmcwhorter
@paulmcwhorter 2 жыл бұрын
Welcome back!
@SaffatUllah
@SaffatUllah Жыл бұрын
You're a legend, Paul! You make programming so much fun! Thank you very much!
@paulmcwhorter
@paulmcwhorter Жыл бұрын
My pleasure!
@tejkhanvilkar5743
@tejkhanvilkar5743 3 жыл бұрын
​really appreciate your video one more amazing lesson Thanks Paul
@alfredcalleja450
@alfredcalleja450 Жыл бұрын
Hi Paul, in my version of this coding I used i and j for each of the loops and set my i counter to start at 0 and the j counter to start at 1 in the appropriate parts of the code: it all worked well. Thanks for another interesting and informative tutorial.
@hojosa4592
@hojosa4592 2 жыл бұрын
I managed to do this assignment, I was preety weary at first seeing as I orginally struggled on for loops initially however now I feel like I have a grasp on the concept before moving on to this lesson so I understood it preety easily when boiled down it is just a different way to format for loop (but in my opinion easier) one thing I did learn though (mostly from me never doing it is knowing you could re apply a variable (in this case j) mid code in my code I just made a new variable for the 2nd while loop really enjoying this series thank you sir!
@ModernDayWanderlust
@ModernDayWanderlust 2 жыл бұрын
Legend. I was able to do the assignment in about ten minutes once I got past the initial "...how do I make this work" brainstorming phase.
@samthelegoman7593
@samthelegoman7593 3 жыл бұрын
Hey Paul! I am legend!! I did the homework slightly differently than you did. In order to break the "asking for grades" while loop, every time, the program would check if the input was "break", and if so, it broke the loop. Thank you so much for all of your amazing lessons Paul, I can't wait for the Arduino with Python lessons!
@yousraabdullah3054
@yousraabdullah3054 2 жыл бұрын
Ugrades = int(input('How Many Grades You Have? ')) gradeslist = [] g = 0 p = 0 while g in range(0, Ugrades, 1): grades = float(input("please Enter Your grades Don't Be Shy : ")) g += 1 gradeslist.append(grades) print('') print('You grades Are: ') print('') while p in range(0, Ugrades,1): print(gradeslist[p]) p += 1 I used another variable (p) to store and print the grades I was mad that It didn't work thou I used the increment But when I saw you work I knew my wrong. Thanks for the Lessons Mr Paul
@danielduplessis7221
@danielduplessis7221 2 жыл бұрын
I Am Legend. Thank You Mr. Paul for Your Help and Encouragement.
@davidschnider1297
@davidschnider1297 Жыл бұрын
Thanks, Paul.. another GREAT lesson.. increasing my Python skills... looking forward to what's next.. .God bless..
@paulmcwhorter
@paulmcwhorter Жыл бұрын
Excellent!
@rafaeloreirorodriguez5278
@rafaeloreirorodriguez5278 2 ай бұрын
Loving every tutorial, you surely deserve a nice premium coffee from South America Mr Mcworther.
@josegermanmolina3544
@josegermanmolina3544 2 жыл бұрын
That "pause pose" kills me 🤣🤣🤣🤣
@markhouston2537
@markhouston2537 2 жыл бұрын
Dear Paul, You are our Huckleberry and for this and your most excellent Python course i have hooked a brother up. Now i'm off to learn more python or die trying.
@paulmcwhorter
@paulmcwhorter 2 жыл бұрын
Thanks, Mark, I appreciate it.
@alexgordon9795
@alexgordon9795 2 жыл бұрын
Thanks to you Paul, I am legend! This was much easier then the for loops!
@paulmcwhorter
@paulmcwhorter 2 жыл бұрын
Glad it helped!
@LegoYobo
@LegoYobo 3 жыл бұрын
your explanation is very easy and nice
@typicalcookies8123
@typicalcookies8123 Жыл бұрын
Thankyou so much for posting these ,you are excellent at conveying messages! I completed the homework quite fast using this code instead nu-int (input ('how many scores do you have?:')) Lt=[] while (0
@learningcode314
@learningcode314 3 жыл бұрын
Great video, Paul! Your lessons are the only ones that make me look forward to homework at the end of the video 😂
@paulmcwhorter
@paulmcwhorter 3 жыл бұрын
Excellent!
@nikolas8741
@nikolas8741 3 жыл бұрын
Hey Paul Can you make video series about programming the DJI Tello Drone and make it fly itself
@Nyviv
@Nyviv 2 жыл бұрын
That would be intresting
@hassanniaz7583
@hassanniaz7583 2 жыл бұрын
I am a LEGEND. One more thing is that I did was that instead of writing j
@petefontana1958
@petefontana1958 2 жыл бұрын
I am legend. Definitely easier than the sort homework. Doing Python tutorials while I am waiting for my Raspberry Pi to come in. Keep up the good work. Will start 14 tomorrow.
@paulmcwhorter
@paulmcwhorter 2 жыл бұрын
The sort, and then the toggle button switch upcoming on my raspberry pi lessons are two classic problems that are very challenging. Simple in concept yet challenging to make work. The key on both is to sketch it out on paper first. When you have a method sketched on paper it is then easy to code up.
@silver5970
@silver5970 3 жыл бұрын
I think the first exercise was pretty easy. I can't wait to the next lesson.
@thirupathaiah2981
@thirupathaiah2981 2 жыл бұрын
This is some while loop ➿ 🤩
@atesotheater6536
@atesotheater6536 3 жыл бұрын
Thank you for the great 👍 lesson
@dmlmedia4665
@dmlmedia4665 3 жыл бұрын
You so great paul
@johnplowright6421
@johnplowright6421 2 жыл бұрын
Got ahead of myself and went for adding two while loops into the grade sorting program from previous lesson, at first though because I used the same global variable the second while loop was already at the end of the count, easy fix but the debugging is the best bit. Oh now I watched the rest of the video you show this same problem ha ha.
@shuttlepodone1707
@shuttlepodone1707 3 жыл бұрын
I am legend! Took a break and then it came to me while doing dishes. Funny how that works.
@bola5671
@bola5671 28 күн бұрын
while loop came back "while" doing dishes? Haha
@chknnoodlz3547
@chknnoodlz3547 3 жыл бұрын
Paul, I think you need to up your game, I haven't yet died trying to learn python, I have been a legend. For real though Paul you are an amazing teacher without your help I wouldn't be learning python this fast.
@hughpatterson1480
@hughpatterson1480 2 жыл бұрын
Ha, I did it but I feel more like a Lazy Boy recliner than a legend. I prefer while loops because of the control factor. My students find them easier to use but you need to know all methods of achieving the same goal to truly understand the problem and it's solution. I had that initial problem that you had on the video, but realized that I did not tell the program to do what it was supposed to do in the second while loop. Thanks again for another great lesson to pass on to my students Paul!
@vaughntaylor2855
@vaughntaylor2855 2 жыл бұрын
The main difference in my first for loop was instead of using the in loop variable of 'grd' with input and appending that to the 'grades' list, I combines the append and in put in one line: grades.append(float(input('Enter a grade: '))). Great lesson Paul! Thank You!
@paulmcwhorter
@paulmcwhorter 2 жыл бұрын
Nice work!
@kestergascoyne6924
@kestergascoyne6924 3 жыл бұрын
So helpful Paul. One day Ill be able to be a Patreon I hope, but for now, thank you.
@thebrector3823
@thebrector3823 2 жыл бұрын
IAM LEGEND, did in 5 mins, thanks to your Arduino tutorials I am familiar with while loops!!
@paulmcwhorter
@paulmcwhorter 2 жыл бұрын
Nice work!
@lakshmadaan8871
@lakshmadaan8871 2 жыл бұрын
Lovely video sir....I am Legend!!!
@martinc9215
@martinc9215 Жыл бұрын
legend 🧑‍🎓
@LiamAllbright
@LiamAllbright 7 ай бұрын
It is a crime that this great video doesn't have enough views or likes, it's a great video, and all of yours are. you make great work. Keep it up! Also, are there going to be more python tutorials, or are you done with it? I hope not. cause these videos are great.
@patfacunla1687
@patfacunla1687 2 жыл бұрын
I am legend! Thanks Paul !
@TheSudouser
@TheSudouser 2 жыл бұрын
Got it! No lawn chair folding this time!
@manavt2000
@manavt2000 2 жыл бұрын
I'm a Legend for this lesson!!!!!!
@soteros1983
@soteros1983 2 жыл бұрын
I'm watching this series after the arduino, next I'm going to wach Raspberry Pi and the rest of Python! Paul is the best :D Do you ever going to make some tutorials for the Raspberry Pi Pico?? it would be very interesting as well! :D
@kingofcastlechaos
@kingofcastlechaos Жыл бұрын
Good series. I did my best to get the exact same Python version you are using but could not find it. This small difference in version has given me SO MANY great learning opportunities as I try to follow along! The good part is that you are teaching me the framework and I am figuring it out from there. Happy accident I guess........(Will save a lot of money on haircuts, tore most of it out! lol)
@shashibhandari6318
@shashibhandari6318 2 жыл бұрын
i am legend , loving it
@IlyesCodes
@IlyesCodes 2 жыл бұрын
best teacher
@advancedperformance9721
@advancedperformance9721 2 жыл бұрын
Great love it
@TheScissorunner
@TheScissorunner Жыл бұрын
I AM LEGENG! Using the print function to print every variable provides feedback for debugging!
@paulmcwhorter
@paulmcwhorter Жыл бұрын
LEGEND!
@gautambiswas7338
@gautambiswas7338 2 жыл бұрын
Managed to do it.
@mikekeller7342
@mikekeller7342 3 жыл бұрын
I am legend! Thanks Paul!!
@paulmcwhorter
@paulmcwhorter 3 жыл бұрын
Yes you are!
@kamwilliams9085
@kamwilliams9085 2 жыл бұрын
I folded Like a cheap walmart Lawn chair. I haven't been very successful with the homework these past few lessons unfortunately. I think I will come back to lessons 10-20 once I finish them and maybe I'll do a better job on the homework assignments.
@ishiandnothingelse
@ishiandnothingelse 3 ай бұрын
the way i work is by looking at the end result and then teaching myself how you got to the end result by applying the knowledge i learnt from your tutorial. i know it's technically cheating, but that's how my brain works, haha. thank you for teaching my coding and making it relatively easy for me to comprehend how it's supposed to work! much appreciated.
@John-vw1wj
@John-vw1wj 3 жыл бұрын
I was starting to fold bad..Could feel my fingers pinching... Hadn't looked a Python for a few daze and was getting a syntax error on a print statement. I was missing a ")" on a previous line all is fine ...now..... I am legend
@railcat7083
@railcat7083 2 жыл бұрын
Legendary...
@rachellebongalon7418
@rachellebongalon7418 3 жыл бұрын
Thank you so much!!!!!
@paulmcwhorter
@paulmcwhorter 3 жыл бұрын
You're welcome!
@tiberiumihaescu5382
@tiberiumihaescu5382 2 жыл бұрын
Still a Legend!
@Mouse_007
@Mouse_007 2 жыл бұрын
I am Legend because you are a great teacher. Thank you.
@paulmcwhorter
@paulmcwhorter 2 жыл бұрын
Thank you! 😃
@user-mn9gw1tr8y
@user-mn9gw1tr8y 6 ай бұрын
GOT IT,AFTER ALMOST 2 HOURS 🤭 Tgrades=float(input('How many grades do you have? ')) H=[] k=1 while k
@jstro-hobbytech
@jstro-hobbytech 2 жыл бұрын
i never do while loops. in all my classes and personal projects ahha. thanks paul
@snakesonthebrain
@snakesonthebrain 3 жыл бұрын
Let’s do it! Straight up black coffee!
@dubrocadidier4583
@dubrocadidier4583 2 жыл бұрын
Legend
@drorlivneh4499
@drorlivneh4499 2 жыл бұрын
I made it, thank you!
@paulmcwhorter
@paulmcwhorter 2 жыл бұрын
Great job!
@professorxavier9692
@professorxavier9692 2 жыл бұрын
11:31 my girlfriend looked over my shoulder to see the legendary Paul frozen to the screen
@ShinesMonkey1
@ShinesMonkey1 3 жыл бұрын
IAL - Arduino series gave me a head start on a lot of this.
@yusufguler1662
@yusufguler1662 3 жыл бұрын
same
@dzeykop
@dzeykop Жыл бұрын
Thank you for another great lesson, Sir! Your lessons are not wasted time (#NWT) for me and that is exactly what I want! 👍
@Fr0ug
@Fr0ug 2 жыл бұрын
I am legend. Awesome channel, love your cintent and coding. A quick question: do you have discord? There is a little discord icon under your coding during the video. :)
@larryplatzek9017
@larryplatzek9017 3 жыл бұрын
I am legend! Did the homework as assigned A employer might not like changes unless was asked about change first!
@EdwardRLyons
@EdwardRLyons 3 жыл бұрын
Success! I Am Legend!
@flhTK-2012
@flhTK-2012 2 жыл бұрын
One little hiccup with the index but solved it in a different way than the example. I decremented the index by1 in the print call. ------------------------ print('It is time to Count!') gradeCount=int(input('Enter the number of grades: ')) grades=[] g=1 while g
@ProfQED
@ProfQED 2 жыл бұрын
I am Legend :) thanks dear Mr. McWhorter 😍😍
@paulmcwhorter
@paulmcwhorter 2 жыл бұрын
Legend!
@HanD_1964
@HanD_1964 3 жыл бұрын
Paul, do you teach us to use functions? I notice that this is necessary for a project that I am doing to keep an overview
@Captain_Vitorio_Muscovy
@Captain_Vitorio_Muscovy Жыл бұрын
My code was a bit different but got the job done; hope this helps: num_grades = int(input("Please inform how many grades you have: ")) grades_list = [] N = 1 G = 1 while N
@constantinstoica9037
@constantinstoica9037 2 жыл бұрын
I am legend. Thanks!
@paulmcwhorter
@paulmcwhorter 2 жыл бұрын
You are!
@darthdaenerys
@darthdaenerys 2 жыл бұрын
I am a legend !
@codecage9333
@codecage9333 3 жыл бұрын
A day late and a dollar short, but I am legend! No cheap Walmart lawn chairs in this neck of the woods!!
@bryankohn9660
@bryankohn9660 3 жыл бұрын
I am legend..piece of cake.
@soundarrajankannan7692
@soundarrajankannan7692 3 жыл бұрын
I am Legend. I used for loop a lot in C language. It is easy to use for loop for me(because all things will be in a single position i.e. initialisation, condition, increment/decrement) in C. But it appears while loop is easy to use in python.
@nikolas8741
@nikolas8741 3 жыл бұрын
Hey Paul Can you make video series about programming the DJI Tello Drone and make it fly itself
@charlielowell4077
@charlielowell4077 2 жыл бұрын
I did it! (and I didn't cheat ;-) ) Although, I admit, I forgot to increment the counter. Oops. Lesson learned. Thanks again!
@larryplatzek9017
@larryplatzek9017 3 жыл бұрын
Paul if this premieres in 6 days how do you alread have 5 likes??? Enjoyed video 12 today and the live chat sessions! have been enjoying Arduino lessons, I need to complete portable temparture version lesson 52.
@danielbanks7500
@danielbanks7500 3 жыл бұрын
Likely early release to Patreon.
@gabrielcmoran
@gabrielcmoran 3 жыл бұрын
Paul, I have a doubt about programming. I'm going to start mechanical engineering in the next semester. You think that programming is useful for this career? I know that a little about this stuff is taught during the course, but I want to know if I have to go further into programming. Sorry if my english is not that good, I'm brazilian and I have been studying your language since last year but I'm far from fluency yet.
@harshjee4134
@harshjee4134 3 жыл бұрын
I am also a student but i think a good engineer must have a decent knowledge of programming. Good knowledge of hardware along with software makes you eligible for jobs in big companies. You can take Mr. Mcworther as an example, he is an electrical engineer, but as you can see through his videos, he is an all-rounder, and that's what makes him a true engineer.
@dmlmedia4665
@dmlmedia4665 3 жыл бұрын
Am a legend have done it
@vwwwvv2383
@vwwwvv2383 2 жыл бұрын
Doing this with while loop is much much better. By the way, I couldn't do the sorted grades so I ended up like a cheap folded walmart. And althought I copied the exact program that you did, it didn't work. It always had a traceback telling that I cannot call a the list/array in the if statement.
@rajeev01in
@rajeev01in 9 ай бұрын
Yes...I am a Legend
@paulmcwhorter
@paulmcwhorter 9 ай бұрын
LEGEND!
@neilausten9404
@neilausten9404 3 жыл бұрын
If you can do this exercise with one while loop (which you can) wouldn't this be the preferred way to go?
@hoggboss4204
@hoggboss4204 2 жыл бұрын
This was much easier to do than the for loops, I can't see what the for loops are doing when they're working so I don't trust it, but this way i know exactly which part is doing what because I made the counter lol. not that i think for loops won't be useful, I just like to know what's happening at every step and this is way easier to read
@amayaphotos8016
@amayaphotos8016 Жыл бұрын
Very True
@sunilkulkarni4426
@sunilkulkarni4426 3 жыл бұрын
HELLO PAUL!...I JUST ADDED +1 TO THE THUMBS UP COUNT...WAITING FOR YOUR VIDEO..............
@paulmcwhorter
@paulmcwhorter 3 жыл бұрын
Awesome thank you!
@chalmerditmars7037
@chalmerditmars7037 Жыл бұрын
I forgot my j+1 and is there any way to stop that program without crashing the whole thing. I used alt control delete. That home work was easy.
@scrappybobbarker5224
@scrappybobbarker5224 2 жыл бұрын
I am legend!
@RDKCREATIONS
@RDKCREATIONS 3 жыл бұрын
Me and my friend devoloping an android app we will release it in playstore soon Where are 14 now
@pedrosojunior
@pedrosojunior 8 ай бұрын
I am a Legend!! Booom
@paulmcwhorter
@paulmcwhorter 8 ай бұрын
LEGEND!
@arpanraval143
@arpanraval143 2 жыл бұрын
I Am Legend!
Python Tutorial 14: Saving and Reading Data Files With Pickle
22:57
Paul McWhorter
Рет қаралды 28 М.
Must-have gadget for every toilet! 🤩 #gadget
00:27
GiGaZoom
Рет қаралды 11 МЛН
터키아이스크림🇹🇷🍦Turkish ice cream #funny #shorts
00:26
Byungari 병아리언니
Рет қаралды 26 МЛН
Wait for the last one! 👀
00:28
Josh Horton
Рет қаралды 108 МЛН
3 wheeler new bike fitting
00:19
Ruhul Shorts
Рет қаралды 50 МЛН
While loops in Python are easy ♾️
6:58
Bro Code
Рет қаралды 317 М.
Python Tutorial 18: Understanding Python Methods and Classes
42:43
Paul McWhorter
Рет қаралды 23 М.
Python 101: Learn the 5 Must-Know Concepts
20:00
Tech With Tim
Рет қаралды 1,1 МЛН
Loops in C++ (for loops, while loops)
12:20
The Cherno
Рет қаралды 396 М.
Python Tutorial 9: Understanding For Loops in Python
36:39
Paul McWhorter
Рет қаралды 41 М.
Python Tutorial 16: Understanding Python Functions
34:26
Paul McWhorter
Рет қаралды 23 М.
Python Tutorial 19: Python Classes and Methods Homework Examples
57:57
If __name__ == "__main__" for Python Developers
8:47
Python Simplified
Рет қаралды 382 М.
Python: While Loops (Reading User Input Indefinitely?!!)
14:40
How To Unlock Your iphone With Your Voice
0:34
요루퐁 yorupong
Рет қаралды 27 МЛН
WWDC 2024 Recap: Is Apple Intelligence Legit?
18:23
Marques Brownlee
Рет қаралды 6 МЛН
Cadiz smart lock official account unlocks the aesthetics of returning home
0:30
Собери ПК и Получи 10,000₽
1:00
build monsters
Рет қаралды 1,5 МЛН