Python Tutorial 13: Understanding Python While Loops

แชร์
ฝัง
  • เผยแพร่เมื่อ 12 ธ.ค. 2024

ความคิดเห็น • 244

  • @chethantb500
    @chethantb500 3 ปีที่แล้ว +13

    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....🤩

  • @amayaphotos8016
    @amayaphotos8016 ปีที่แล้ว +3

    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

  • @kck.Schrodinger13
    @kck.Schrodinger13 3 ปีที่แล้ว +1

    I AM FINALLY LEGEND after a losing streak! Having so much fun with these lessons.

  • @426F6F
    @426F6F ปีที่แล้ว

    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!

  • @sudhanshupawar8760
    @sudhanshupawar8760 2 ปีที่แล้ว +1

    i used to hate programming before i started watching your tutorials...you really make programming fun

  • @kamwilliams9085
    @kamwilliams9085 2 ปีที่แล้ว +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.

  • @OzdemirCem
    @OzdemirCem 3 ปีที่แล้ว +1

    Paul's words are really understandable. Congratulations. Doing homework is very important. The code is not written without encountering the problem.

  • @opalprestonshirley1700
    @opalprestonshirley1700 3 ปีที่แล้ว +3

    Got it, Paul, I am legend. Enjoyed the lesson. Looking forward to reading and writing files. Have a great week.

  • @pauivorra1819
    @pauivorra1819 3 ปีที่แล้ว +4

    I am legend, despite this homework was easier than other ones.

  • @petefontana1958
    @petefontana1958 2 ปีที่แล้ว +1

    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 ปีที่แล้ว +1

      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.

  • @dawidstawowy6474
    @dawidstawowy6474 3 ปีที่แล้ว

    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!

  • @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

  • @yousraabdullah3054
    @yousraabdullah3054 3 ปีที่แล้ว

    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

  • @johnplowright6421
    @johnplowright6421 3 ปีที่แล้ว

    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.

  • @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.

  • @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.

  • @hassanniaz7583
    @hassanniaz7583 3 ปีที่แล้ว

    I am a LEGEND. One more thing is that I did was that instead of writing j

  • @mohsenr4434
    @mohsenr4434 2 ปีที่แล้ว

    I did the homework and debugged it on my own. Good lesson as always, thanks.

  • @SaffatUllah
    @SaffatUllah ปีที่แล้ว

    You're a legend, Paul! You make programming so much fun! Thank you very much!

  • @cbrombaugh
    @cbrombaugh 3 ปีที่แล้ว +1

    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.

  • @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.

  • @markhouston2537
    @markhouston2537 3 ปีที่แล้ว

    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  3 ปีที่แล้ว

      Thanks, Mark, I appreciate it.

  • @davidschnider1297
    @davidschnider1297 ปีที่แล้ว

    Thanks, Paul.. another GREAT lesson.. increasing my Python skills... looking forward to what's next.. .God bless..

  • @josegermanmolina3544
    @josegermanmolina3544 2 ปีที่แล้ว

    That "pause pose" kills me 🤣🤣🤣🤣

  • @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.

  • @vaughntaylor2855
    @vaughntaylor2855 3 ปีที่แล้ว

    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!

  • @martinlewis645
    @martinlewis645 3 ปีที่แล้ว

    I'm back after a nice Spring/Summer break and I Am Legend! Thank you Paul.

  • @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!

  • @anishhansoge17
    @anishhansoge17 3 ปีที่แล้ว

    IAM LEGEND, did in 5 mins, thanks to your Arduino tutorials I am familiar with while loops!!

  • @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!

  • @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!

  • @LiamAllbright
    @LiamAllbright ปีที่แล้ว +1

    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.

  • @danielduplessis7221
    @danielduplessis7221 3 ปีที่แล้ว

    I Am Legend.
    Thank You Mr. Paul for Your Help and Encouragement.

  • @johnplowright6421
    @johnplowright6421 3 ปีที่แล้ว

    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.

  • @AmidaBashiru
    @AmidaBashiru 11 หลายเดือนก่อน

    GOT IT,AFTER ALMOST 2 HOURS 🤭
    Tgrades=float(input('How many grades do you have? '))
    H=[]
    k=1
    while k

  • @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

  • @learningcode314
    @learningcode314 3 ปีที่แล้ว +1

    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 ปีที่แล้ว +1

      Hey Paul Can you make video series about programming the DJI Tello Drone and make it fly itself

    • @Nyviv
      @Nyviv 3 ปีที่แล้ว

      That would be intresting

  • @shuttlepodone1707
    @shuttlepodone1707 3 ปีที่แล้ว +2

    I am legend! Took a break and then it came to me while doing dishes. Funny how that works.

    • @bola5671
      @bola5671 6 หลายเดือนก่อน

      while loop came back "while" doing dishes? Haha

  • @pralaymajumdar1206
    @pralaymajumdar1206 3 ปีที่แล้ว

    Very knowledgeable and inspirational lecture... Thank you sir and waiting for the next week.

  • @TheScissorunner
    @TheScissorunner 2 ปีที่แล้ว

    I AM LEGENG! Using the print function to print every variable provides feedback for debugging!

  • @alexgordon9795
    @alexgordon9795 3 ปีที่แล้ว

    Thanks to you Paul, I am legend! This was much easier then the for loops!

  • @jeff_wild
    @jeff_wild 5 หลายเดือนก่อน

    Done. My $.02, for loops are much cleaner: the counter is initialized, the limit set, and the increment defined in one line of code instead of three.

  • @ishiFNV
    @ishiFNV 8 หลายเดือนก่อน

    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

  • @soteros1983
    @soteros1983 2 ปีที่แล้ว +1

    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

  • @Captain_Vitorio_Muscovy
    @Captain_Vitorio_Muscovy 2 ปีที่แล้ว

    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

  • @Med2402
    @Med2402 16 วันที่ผ่านมา

    Loops have frazzled some neurons in my brain; that's why I'm here, attempting to repair them.
    Thank you

  • @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)

  • @Mouse_007
    @Mouse_007 3 ปีที่แล้ว

    I am Legend because you are a great teacher. Thank you.

  • @tejkhanvilkar5743
    @tejkhanvilkar5743 3 ปีที่แล้ว

    ​really appreciate your video one more amazing lesson
    Thanks Paul

  • @rafaeloreirorodriguez5278
    @rafaeloreirorodriguez5278 8 หลายเดือนก่อน

    Loving every tutorial, you surely deserve a nice premium coffee from South America Mr Mcworther.

  • @silver5970
    @silver5970 3 ปีที่แล้ว

    I think the first exercise was pretty easy. I can't wait to the next lesson.

  • @thirupathaiah2981
    @thirupathaiah2981 3 ปีที่แล้ว +1

    This is some while loop ➿ 🤩

  • @LegoYobo
    @LegoYobo 3 ปีที่แล้ว

    your explanation is very easy and nice

  • @TheSudouser
    @TheSudouser 2 ปีที่แล้ว

    Got it! No lawn chair folding this time!

  • @manavt2000
    @manavt2000 3 ปีที่แล้ว

    I'm a Legend for this lesson!!!!!!

  • @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.

  • @ShinesMonkey1
    @ShinesMonkey1 3 ปีที่แล้ว

    IAL - Arduino series gave me a head start on a lot of this.

  • @lakshmadaan8871
    @lakshmadaan8871 2 ปีที่แล้ว +1

    Lovely video sir....I am Legend!!!

  • @RDKCREATIONS
    @RDKCREATIONS 3 ปีที่แล้ว +2

    Me and my friend devoloping an android app we will release it in playstore soon
    Where are 14 now

  • @larryplatzek9017
    @larryplatzek9017 3 ปีที่แล้ว

    I am legend! Did the homework as assigned A employer might not like changes unless was asked about change first!

  • @kestergascoyne6924
    @kestergascoyne6924 3 ปีที่แล้ว

    So helpful Paul.
    One day Ill be able to be a Patreon I hope, but for now, thank you.

  • @codecage9333
    @codecage9333 3 ปีที่แล้ว +1

    A day late and a dollar short, but I am legend! No cheap Walmart lawn chairs in this neck of the woods!!

  • @nikolas8741
    @nikolas8741 3 ปีที่แล้ว

    Hey Paul Can you make video series about programming the DJI Tello Drone and make it fly itself

  • @IlyesCodes
    @IlyesCodes 2 ปีที่แล้ว

    best teacher

  • @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.

  • @aungphyokyaw4475
    @aungphyokyaw4475 5 หลายเดือนก่อน

    I was able to do it using only one while loop. for printing grades I just printed grades outside of the while loop.

  • @Fr0ug
    @Fr0ug 3 ปีที่แล้ว

    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. :)

  • @jstro-hobbytech
    @jstro-hobbytech 2 ปีที่แล้ว

    i never do while loops. in all my classes and personal projects ahha. thanks paul

  • @handofash
    @handofash 3 ปีที่แล้ว

    I tried a method to shortcut variable "j" by using numGrades value in the parameters instead.
    I got it to work, but I couldn't print it out in its proper list form.
    I guess you can't avoid a proper index number.

  • @patfacunla1687
    @patfacunla1687 3 ปีที่แล้ว

    I am legend! Thanks Paul !

  • @shashibhandari6318
    @shashibhandari6318 3 ปีที่แล้ว

    i am legend , loving it

  • @mikekeller7342
    @mikekeller7342 3 ปีที่แล้ว

    I am legend! Thanks Paul!!

  • @snakesonthebrain
    @snakesonthebrain 3 ปีที่แล้ว

    Let’s do it! Straight up black coffee!

  • @professorxavier9692
    @professorxavier9692 2 ปีที่แล้ว

    11:31 my girlfriend looked over my shoulder to see the legendary Paul frozen to the screen

  • @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

  • @crazytroll935
    @crazytroll935 4 หลายเดือนก่อน

    I AM LEGEND, Finally

  • @charlotteswift
    @charlotteswift 3 ปีที่แล้ว

    When you said at the beginning of your solution that you had to start with j=0 because you were appending to an array, this was a bit of a red herring because you don't actually use j in your append command. Of course, you DO need to start from 0 when printing the grades. I don't mean to be picky but this could confuse a stupid person.

  • @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?

  • @atesotheater6536
    @atesotheater6536 3 ปีที่แล้ว

    Thank you for the great 👍 lesson

  • @larryplatzek9017
    @larryplatzek9017 3 ปีที่แล้ว +1

    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.

  • @dmlmedia4665
    @dmlmedia4665 3 ปีที่แล้ว

    You so great paul

  • @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!

  • @gautambiswas7338
    @gautambiswas7338 2 ปีที่แล้ว

    Managed to do it.

  • @tiberiumihaescu5382
    @tiberiumihaescu5382 3 ปีที่แล้ว

    Still a Legend!

  • @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

  • @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.

  • @railcat7083
    @railcat7083 3 ปีที่แล้ว

    Legendary...

  • @DianaRoss-s3f
    @DianaRoss-s3f 10 หลายเดือนก่อน

    AFTER ALMOST 12 HOURS, SHAME ON ME, BUT I DID IT
    numgrades=int(input("How many grades do you have? "))
    Grades=[]
    grades=1
    while (grades

  • @ProfQED
    @ProfQED 2 ปีที่แล้ว

    I am Legend :) thanks dear Mr. McWhorter 😍😍

  • @criptosauro4587
    @criptosauro4587 ปีที่แล้ว

    Why
    grades[j] = float(input("please write grade "))
    Does not work?

  • @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.

  • @allenbennett8735
    @allenbennett8735 ปีที่แล้ว

    Can you use a while loop to determine how many grades you want to input?

    • @paulmcwhorter
      @paulmcwhorter  ปีที่แล้ว

      Yes, but you would need some key to tell it to exit the loop. Like keep inputting grades until it sees you enter 'q'

    • @allenbennett8735
      @allenbennett8735 ปีที่แล้ว

      @@paulmcwhorter That's why I thought of a while loop--I couldn't yhink of any way a for loop would work.

  • @rachellebongalon7418
    @rachellebongalon7418 3 ปีที่แล้ว

    Thank you so much!!!!!

  • @advancedperformance9721
    @advancedperformance9721 3 ปีที่แล้ว

    Great love it

  • @danielbanks7500
    @danielbanks7500 3 ปีที่แล้ว

    No folding like cheap Walmart chairs here! I am Legend!

  • @darthdaenerys
    @darthdaenerys 3 ปีที่แล้ว +1

    I am a legend !

  • @drorlivneh4499
    @drorlivneh4499 2 ปีที่แล้ว

    I made it, thank you!

  • @oluwatoyinkalejaiye3331
    @oluwatoyinkalejaiye3331 4 หลายเดือนก่อน

    i love your content i am legend!!!! btw your amazinn

  • @sunilkulkarni4426
    @sunilkulkarni4426 3 ปีที่แล้ว

    HELLO PAUL!...I JUST ADDED +1 TO THE THUMBS UP COUNT...WAITING FOR YOUR VIDEO..............