While loops in Python are easy ♾️

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

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

  • @BroCodez
    @BroCodez  2 года назад +135

    #while loop = perform some code WHILE some condition remains true
    # ---------------- EXAMPLE 1 ----------------
    name = input("Enter your name: ")
    while name == "":
    print("You did not enter your name!")
    name = input("Enter your name: ")
    print(f"Hello {name}")
    # ---------------- EXAMPLE 2 ----------------
    age = int(input("Enter your age: "))
    while age < 0:
    print("Age can't be negative")
    age = int(input("Enter your age: "))
    print(f"You are {age} years old")
    # ---------------- EXAMPLE 3 ----------------
    food = input("Enter a food you like (q to quit): ")
    while not food == "q":
    print(f"You like {food}")
    food = input("Enter another food you like (q to quit): ")
    print("bye")
    # ---------------- EXAMPLE 4 ----------------
    num = int(input("Enter a # between 1 - 10: "))
    while num < 1 or num > 10:
    print(f"{num} is not valid")
    num = int(input("Enter a # between 1 - 10: "))
    print(f"You picked the number {num}")

    • @rm-vo5zu
      @rm-vo5zu 2 года назад +4

      thank u soo much bro for the video as well as the code here☝

    • @alexak8671
      @alexak8671 Год назад +2

      Thank you for your efforts 🤩!!

    • @joshua476
      @joshua476 5 месяцев назад +2

      Hi, i tried the first example, i have exactly what you have but if i enter a name it doesnt print the f string, it just ends, if i dont put anything that part works

    • @PiyushGupta-j6y
      @PiyushGupta-j6y 4 дня назад

      This cleared all my doubts
      Thank you sir for your effortss !!!!

  • @christopherbermudez1528
    @christopherbermudez1528 2 года назад +327

    You explained this so clearly. Easiest “while” video to understand for me thus far. Liked.

    • @buenolvr
      @buenolvr Год назад +2

      This*

    • @simonaubrey6326
      @simonaubrey6326 Год назад +14

      @@buenolvrthus is grammatically correct here

    • @iSwearToCod
      @iSwearToCod Год назад +4

      @@buenolvr if it said this it would be incorrect. dafuq

    • @_Debs_16
      @_Debs_16 7 месяцев назад +1

      innit bro this guy is brilliant

    • @sportforumOFFICIAL
      @sportforumOFFICIAL 2 месяца назад

      @@_Debs_16 broo isd idk what the hell ts was till i saw this vid

  • @free-bible-study
    @free-bible-study 5 месяцев назад +42

    As a senior (citizen.) trying to learn Python on YT I must say this is the clearest explanation of while loops I have seen todate. Thank you so much.

    • @dazcode
      @dazcode 5 месяцев назад +4

      You aint a senior dude.
      seniors dont say YT bro
      quit fooling

    • @jim2376
      @jim2376 5 месяцев назад +1

      Ditto. (Both as to senior (73) and the clarity of the explanation.)

  • @VexRuby21
    @VexRuby21 2 месяца назад +6

    Schools gonna be outta business-thank you so much- clear and precise teaching

  • @saturncosmos
    @saturncosmos Год назад +41

    Thank you so much for this video! I have been stuck on while loops for two days. I understand it so much more now. You rock!

  • @billalkhwaja851
    @billalkhwaja851 Год назад +22

    Thank you very much, this is the first time I have actually completely understood how to implement a while loop without having to deal with infinite responses. Your video was great and helped a lot. Cheers

  • @pirunnyrkki518
    @pirunnyrkki518 Год назад +8

    This was the best explanation video so far that i found. And probably the best Coding based teaching YT I have came across.

  • @bilal.rk09
    @bilal.rk09 Год назад +4

    You are one of the best tutor in youtube for Python tutorials.

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

      i can show u a toutoriaalalaalal

  • @serdanaksunger2942
    @serdanaksunger2942 Год назад +2

    you are the only one in yt who explain correctly

  • @myeducationvlogs8483
    @myeducationvlogs8483 2 года назад +17

    You became my favourite coder and teacher💯❤️🤝😊

  • @abdulserwanga6946
    @abdulserwanga6946 Год назад +1

    Following from Uganda , This is the best explanation have received . finally understood while loops

  • @rikuyaosawa9495
    @rikuyaosawa9495 10 месяцев назад +5

    Showing this to my girlfriend who is learning to code. Thanks!!

  • @ssigitas69
    @ssigitas69 2 года назад +6

    Wow. Thats what I needed!!!! I am learning and learning loops and anyway can't understand how it's works. Maybe now I will. Thanks Bro!
    Now I need to find you video for for loop as well ;)

  • @crimsonphoenix8907
    @crimsonphoenix8907 10 месяцев назад

    man you explained this so clearly it makes me wonder why I’m having so much difficulty with it

  • @bernardoherrero2027
    @bernardoherrero2027 2 месяца назад +1

    This is very nice video, very clear, which is what I (just another regular viewer who tries to learn Python) want to see

  • @_Debs_16
    @_Debs_16 7 месяцев назад +1

    best tutor, even better than my computing teacher🤣

  • @WINDOWSUSER-q4s
    @WINDOWSUSER-q4s Год назад +1

    NICELY DONE BRO...❤

  • @adailsoncarlos3122
    @adailsoncarlos3122 9 месяцев назад

    Bro, i just spend a lot of time searching how to exit a while loop with one key and did not finding anything that make some sense to me and you explained it in six minutes, thanks a lot!

  • @focuz24
    @focuz24 Год назад +2

    Thanks!! I stuck in while loop as well. Now I understand how it works.

  • @wolcamophone4783
    @wolcamophone4783 Месяц назад

    OMG MAN THANK YOU SOOO MUCH THIS VID IS A LIFE SAVER! My comp science master's thesis is due tomorrow and I hadn't even selected my cites or refs until now!

  • @Zain-xu3rv
    @Zain-xu3rv Месяц назад +2

    excellent explanation, thanks

  • @ahmadrandhawa238
    @ahmadrandhawa238 Год назад +2

    Good one sir

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

    I understanted so very well, you explain better than 99% people in this world, many thanks!

  • @vaibhavmalhotra4855
    @vaibhavmalhotra4855 9 месяцев назад

    I've been in tech studies for long time but now I came to fully understand how while loop works

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

    I'm not even learning python, this is just good programming explanation, thank you!

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

    Your youtube channel has been real helpful, thank you!

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

    Finally a video that explains it from scratch with easy examples rather than rocket science

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

    This is the best python tutorial so far, I read a book but I couldn't understand clearly

  • @DyNaMiC_GG
    @DyNaMiC_GG 5 месяцев назад

    thanks man , it looked so easy but it is actually tough when we learn it for the first time .

  • @Gstt9
    @Gstt9 9 месяцев назад +1

    bro, you is the best
    i'm getting a lot better
    thanks

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

    The best video to explain the while loop ever

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

    Bro. Now this is bro code. You are a good teacher👌👌👌👌

  • @AnzhelikaSharipbekkyzy
    @AnzhelikaSharipbekkyzy 9 месяцев назад

    thank you very much for the best explaining even our professor could not explain such good as you for 6 min i understood everything that we were learning for 1 week

  • @golamkibriaofficial320
    @golamkibriaofficial320 10 месяцев назад

    This was really an interesting video in term of learning python and whole the tutorial is really appreciated just for helping us giving detailed information........................................

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

    honstly salute to you si. this is far by the easiest explanation of while loops

  • @MRCLEEN
    @MRCLEEN Год назад +1

    I now understand while loops better after watching this thank you

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

    I was having a tough time understanding while loops in my intro class, but this was so helpful. Thank you!

  • @LilJollyJoker
    @LilJollyJoker Год назад +1

    Finally, an easy explanation! Thank you!

  • @Pourya-s4u
    @Pourya-s4u 4 месяца назад

    Bro your courses saving lives

  • @ShaikSameer-u7b
    @ShaikSameer-u7b Год назад

    Thank you very much now I'm learning data science course it will be more useful for me to understand the python programming language very easily

  • @mannykhan7752
    @mannykhan7752 27 дней назад

    Really enjoy your videos. Great work.

  • @MateusLima-iu5wc
    @MateusLima-iu5wc 9 месяцев назад

    bro, i love you. you literally did just saved me

  • @lopexaaz.kitchen628
    @lopexaaz.kitchen628 Год назад

    Best Vid to understand the while Loop. Great job

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

    simple yet very clear and easy to understand.. thank you so much

  • @Jggapp016
    @Jggapp016 2 года назад +4

    Thank you to help us improve our programing

  • @Iskm.28
    @Iskm.28 Год назад

    Thanks! This has been the best and easiest tutorial for me to understand 👏 The explanation is quit simple and clear to the point. 🔥

  • @farahbaliki4680
    @farahbaliki4680 Год назад +7

    I've been finding it so difficult when it comes to while loops, you made this so easy thank you!
    But is it not necessary to use else: statement??

    • @ashkiravods
      @ashkiravods Год назад +2

      Not necessarily. if a while loop exits due to the condition being false, the upcoming lines of code will be executed.
      Loops can either be exited with the while condition being false, or with the help of 'break'
      #example:
      i=1
      while i in range(6):
      print(i)
      i+=1
      if i==6:
      break
      else:
      print("no break")
      In this code, since break is used to exit the loop, the else statement doesn't get executed. but if the if block is commented out, you could see that it runs the else statement after the loop gets exited.

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

    BEST TUTORIAL EVER! THANK YOU SO MUCH MY EXAM IS TOMMOROW

  • @user01-n6p
    @user01-n6p 7 месяцев назад

    A very concise explanation as expected.

  • @Nk_Lifestyle1
    @Nk_Lifestyle1 Год назад +2

    So basically for example one if the user does not input their name, the while loop will keep asking for the user name until the condition is true and print out hello to the user

  • @Theinfo34652
    @Theinfo34652 5 месяцев назад

    well explained
    thanks for making me understand about while loop
    appreciated

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

    This makes so much sense now. Thank you Bro Code.

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

    I've been working on this from months and you made me understand in minutes 😍

  • @koofrehdavies2435
    @koofrehdavies2435 8 месяцев назад

    Excellently explained

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

    Easy explanation so far .. ♥️

  • @rhapsody1819
    @rhapsody1819 2 года назад +4

    Thanks bro! You're helping me a lot

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

    What an informative video!! I find this video super helpful with such clear explanations!! Thank yoou so much!

  • @fleetboy5705
    @fleetboy5705 3 месяца назад +1

    The real sigma
    Charity donar + high quality, quantity videos ❤

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

    Great 🎉

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

    You need put this whole python videos to compilation so we know tools about python

  • @HebaZainab-wg5dk
    @HebaZainab-wg5dk Год назад

    You explained soo clearly , i have a test tomorrow on this chapter and this video helped a lot , thankyou

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

      good luck on your test. i got exam in jan coming up for coding in python.

  • @Hamyto41664
    @Hamyto41664 6 месяцев назад +1

    Bro explains as good as networkchuck in a unique way.

  • @lesclart
    @lesclart 2 года назад +4

    thanks for teaching me the WoW loop :)

  • @riccardoholder6378
    @riccardoholder6378 9 месяцев назад

    thanks for making this video,
    name = input("Please enter your name and no symbols or number: ")
    while name.isalpha() == False:
    print("You have either enter a number or symbol in your name, please try again:")
    name = input("Please enter your name and no symbols or number: ")
    else:
    print(f"Hello there {name}, thank you for following instructions")

  • @mayurkanth6987
    @mayurkanth6987 2 года назад +2

    Best Bro 😀

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

    This tutorial helped so much with understansding the for while loop

  • @dishant_7
    @dishant_7 9 месяцев назад

    You made it so easy . Thanks bro ❤

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

    Beautiful! YOU ARE THE BEST!!!

  • @fastrobreetus
    @fastrobreetus 6 месяцев назад

    great video

  • @evan._.7436
    @evan._.7436 Год назад

    Thanks for the help, much better than coursera's courses, and their explanation on loops in general. Subscribed!

  • @ZH1NBAD
    @ZH1NBAD 2 года назад +4

    you are really a Bro for teaching us while loop and making it looks so easy thanks !

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

    This is the best explanation ive had

  • @1976JT
    @1976JT 9 месяцев назад

    thanks for making this easy to understand.

  • @Mir-ette-g3
    @Mir-ette-g3 Год назад

    in love! finally i understand while !!

  • @alexak8671
    @alexak8671 Год назад +1

    Thank you for the clear explanation 🤩!!

  • @hishamdebis9490
    @hishamdebis9490 9 месяцев назад

    Great

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

    My prof said that the "not" is rarely seen in coding then he used it, WOW!!!

  • @cse-17akashkumar32
    @cse-17akashkumar32 2 года назад +1

    You are doing a great work

  • @affable.pebble
    @affable.pebble Год назад

    This is pretty fun, thanks!

  • @cugansteamid6252
    @cugansteamid6252 2 месяца назад

    thanks this was beautifully explained.

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

    nice video❤

  • @박현준-g9g2x
    @박현준-g9g2x Год назад

    How can it be so easy!!! thanks a lot!

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

    Thank you for making it simple.

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

    good work bro!

  • @franklingonzalez6774
    @franklingonzalez6774 8 месяцев назад

    2-hour lecture of the professor yapping vs a 6-minute video to learn so much more

  • @JustJ22534
    @JustJ22534 6 месяцев назад

    thanks a lot bro im starting python and this helps

  • @dimitrioszafeiropoulos673
    @dimitrioszafeiropoulos673 6 месяцев назад

    nice video, thanks Bro!!!

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

    you saved some lives here

  • @jeshy9810
    @jeshy9810 2 года назад +2

    Thank you! You're a great teacher!

  • @cvreddy4574
    @cvreddy4574 10 месяцев назад

    Thanks man!! It's a good explanation

  • @anthonyhalim1454
    @anthonyhalim1454 2 года назад +2

    hello sir, why my computer when running infinite loop such like your video in 2:14 caused my mac so hot (%CPU about 300%)? i'm using python from conda, vs code, and macos ventura

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

      while loop is infinite and when it runs it puts a load on your pc sometimes if you don't stop it your code editor might also crash

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

      @@abdevil2330 but some of my other machine, let say intel mac doesnt get so hot, but the performance also slower than this silicon mac, i dont know if the configuration is the problem or what. let say the other machine (my android, running python with pydroid3) also doesnt get hot neither crash.

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

    Big thank you for your excellent video!

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

    Brocode is really a big bro❤

  • @LA-cy1zj
    @LA-cy1zj 2 года назад +2

    that explanation was so good I transcribed some of it for my notes verbatim!

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

    Super

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

    Thank you very much for doing this.

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

    thank u so much this video explained clear but can u help me explain why when i'm writing nested while not working ? please can u help please

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

    thanks to you i undrstand this while loop thank you so much

  • @AestheticBlue13
    @AestheticBlue13 6 месяцев назад

    enter = input("Would you like to say your favourite food? (y/n): ")
    while enter == "y":
    food = input("Enter your favourite food: ")
    enter = input("Would you like to say another favourite food? (y/n): ")
    print("Thanks for stopping by!")

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

    Such a good video!! Thank you so much for this tutorial it helped a lot.