Python Tutorial 13: Understanding Python While Loops

Поделиться
HTML-код
  • Опубликовано: 16 ноя 2024

Комментарии • 240

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

  • @sudhanshupawar8760
    @sudhanshupawar8760 2 года назад +1

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

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

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

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

  • @opalprestonshirley1700
    @opalprestonshirley1700 3 года назад +3

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

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

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

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

  • @pauivorra1819
    @pauivorra1819 3 года назад +4

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

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

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

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

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

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

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

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

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

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

  • @hassanniaz7583
    @hassanniaz7583 3 года назад

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

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

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

  • @mohsenr4434
    @mohsenr4434 2 года назад

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

  • @martinlewis645
    @martinlewis645 3 года назад

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

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

  • @anishhansoge17
    @anishhansoge17 3 года назад

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

  • @SaffatUllah
    @SaffatUllah Год назад

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

  • @davidschnider1297
    @davidschnider1297 Год назад

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

  • @ishiFNV
    @ishiFNV 7 месяцев назад

    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.

  • @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 5 месяцев назад

      while loop came back "while" doing dishes? Haha

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

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

  • @jeff_wild
    @jeff_wild 4 месяца назад

    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.

  • @AmidaBashiru
    @AmidaBashiru 11 месяцев назад

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

  • @TheScissorunner
    @TheScissorunner 2 года назад

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

  • @LiamAllbright
    @LiamAllbright 11 месяцев назад +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.

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

  • @danielduplessis7221
    @danielduplessis7221 3 года назад

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

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

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

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

  • @alexgordon9795
    @alexgordon9795 3 года назад

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

  • @silver5970
    @silver5970 3 года назад

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

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

  • @thirupathaiah2981
    @thirupathaiah2981 3 года назад +1

    This is some while loop ➿ 🤩

  • @pralaymajumdar1206
    @pralaymajumdar1206 3 года назад

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

  • @josegermanmolina3544
    @josegermanmolina3544 2 года назад

    That "pause pose" kills me 🤣🤣🤣🤣

  • @rafaeloreirorodriguez5278
    @rafaeloreirorodriguez5278 7 месяцев назад

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

  • @Mouse_007
    @Mouse_007 3 года назад

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

  • @LegoYobo
    @LegoYobo 3 года назад

    your explanation is very easy and nice

  • @ShinesMonkey1
    @ShinesMonkey1 3 года назад

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

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

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

  • @TheSudouser
    @TheSudouser 2 года назад

    Got it! No lawn chair folding this time!

  • @tejkhanvilkar5743
    @tejkhanvilkar5743 3 года назад

    ​really appreciate your video one more amazing lesson
    Thanks Paul

  • @kestergascoyne6924
    @kestergascoyne6924 3 года назад

    So helpful Paul.
    One day Ill be able to be a Patreon I hope, but for now, 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.

  • @jstro-hobbytech
    @jstro-hobbytech 2 года назад

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

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

  • @larryplatzek9017
    @larryplatzek9017 3 года назад

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

  • @lakshmadaan8871
    @lakshmadaan8871 2 года назад +1

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

  • @manavt2000
    @manavt2000 3 года назад

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

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

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

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

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

  • @snakesonthebrain
    @snakesonthebrain 3 года назад

    Let’s do it! Straight up black coffee!

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

  • @mikekeller7342
    @mikekeller7342 3 года назад

    I am legend! Thanks Paul!!

  • @atesotheater6536
    @atesotheater6536 3 года назад

    Thank you for the great 👍 lesson

  • @gautambiswas7338
    @gautambiswas7338 2 года назад

    Managed to do it.

  • @IlyesCodes
    @IlyesCodes 2 года назад

    best teacher

  • @aungphyokyaw4475
    @aungphyokyaw4475 4 месяца назад

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

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

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

  • @dmlmedia4665
    @dmlmedia4665 3 года назад

    You so great paul

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

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

  • @criptosauro4587
    @criptosauro4587 Год назад

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

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

  • @shashibhandari6318
    @shashibhandari6318 3 года назад

    i am legend , loving it

  • @tiberiumihaescu5382
    @tiberiumihaescu5382 3 года назад

    Still a Legend!

  • @RDKCREATIONS
    @RDKCREATIONS 3 года назад +2

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

  • @crazytroll935
    @crazytroll935 3 месяца назад

    I AM LEGEND, Finally

  • @railcat7083
    @railcat7083 3 года назад

    Legendary...

  • @patfacunla1687
    @patfacunla1687 3 года назад

    I am legend! Thanks Paul !

  • @darthdaenerys
    @darthdaenerys 3 года назад +1

    I am a legend !

  • @professorxavier9692
    @professorxavier9692 2 года назад

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

  • @waleedaiad3411
    @waleedaiad3411 2 года назад

    How can i use hc-12 with arduino using python language?

  • @sunilkulkarni4426
    @sunilkulkarni4426 3 года назад

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

  • @bryankohn9660
    @bryankohn9660 3 года назад

    I am legend..piece of cake.

  • @ProfQED
    @ProfQED 2 года назад

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

  • @EdwardRLyons
    @EdwardRLyons 3 года назад

    Success! I Am Legend!

  • @drorlivneh4499
    @drorlivneh4499 2 года назад

    I made it, thank you!

  • @DianaRoss-s3f
    @DianaRoss-s3f 9 месяцев назад

    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

  • @rachellebongalon7418
    @rachellebongalon7418 3 года назад

    Thank you so much!!!!!

  • @danielbanks7500
    @danielbanks7500 3 года назад

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