For loops in Python are easy 🔁

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

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

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

    # for loops = execute a block of code a fixed number of times.
    # You can iterate over a range, string, sequence, etc.
    # ---------------- EXAMPLE 1 ----------------
    for x in range(1, 11):
    print(x)
    # ---------------- EXAMPLE 2 ----------------
    for x in reversed(range(1, 11)):
    print(x)
    print("Happy New Year!")
    # ---------------- EXAMPLE 3 ----------------
    for x in range(1, 11, 2):
    print(x)
    # ---------------- EXAMPLE 4 ----------------
    credit_card = "1234-5678-9012-3456"
    for x in credit_card:
    print(x)
    # ---------------- CONTINUE ----------------
    for x in range(1, 21):
    if x == 13:
    continue
    else:
    print(x)
    # ---------------- BREAK ----------------
    for x in range(1, 21):
    if x == 13:
    break
    else:
    print(x)

    • @doober.43
      @doober.43 2 года назад

      hi

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

      Hey bro, I don’t know if you would have the time to do this. But PLEASE could you do a lua guide from scratch. There are barley any tutorials on YT. And none of them are very good. All I ask is just for around an hour course. But more would be a bonus

    • @ShivamKumar-rz7uv
      @ShivamKumar-rz7uv Год назад

      bro code -- range star pattern !!!!

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

      Yes..scratch would be helpful!🙏😿

    • @AdityaPandya-l6n
      @AdityaPandya-l6n Месяц назад +1

      Thanks from india bro

  • @Draurore
    @Draurore 9 месяцев назад +20

    i just need to say thank you, i have a programming exam tomorrow and your videos are saving my life

  • @Qtaro-oh
    @Qtaro-oh 2 года назад +156

    You got me into programming

    • @droneit7961
      @droneit7961 4 месяца назад +2

      are you still in programming?

    • @Qtaro-oh
      @Qtaro-oh 4 месяца назад

      @@droneit7961 i still am but i stopped for months because i have a final exam and i’ll finally graduate ;))

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

      Im also wondering, still grinding?

    • @Qtaro-oh
      @Qtaro-oh 2 месяца назад +5

      I don’t know if this is considered programming but after a very long while of learning python and c++ i recently decided to start developing a roblox game in Lua (which im doing at this very moment while typing this reply)

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

      ​@@Qtaro-oh you learning loops logic and developed a game?

  • @minterdaly1265
    @minterdaly1265 2 дня назад

    You explain everything in such an easy to understand way

  • @김두현-s8p
    @김두현-s8p 24 дня назад +1

    Thank you! Im taking python course by myself but 100 day python instructor didnt explain well. This makes me understand superbly well!

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

    Welp that made my understanding more clearer, at first I was on a course learning for loops and implementing it Into real situations like a website or software and I was confused but once I saw this it made the understanding of it easier thank you

  • @En1gma2u
    @En1gma2u Год назад +16

    Best explanation and easy to understand. Thank you!!

  • @grey8854
    @grey8854 Месяц назад +1

    Finally! Someone who gets straight to the point!

  • @stanislawignacy
    @stanislawignacy Год назад +6

    bro that's even better than yout 12-hour tutorial piece. I had a small doubts how range can be iterated but now I understand it!

  • @julialouise969
    @julialouise969 Месяц назад +1

    Thank u so much for this video. I was having trouble for understanding this function with my professor's videos. You explained it so well.

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

    This stuff was confusing in my course and in my book. This really helped clear up some confusion. Thanks man!

  • @Hamyto41664
    @Hamyto41664 3 месяца назад +12

    bro's a gigachad, physically and mentally

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

    I was first confused at coding but ur explanation is marvelous i like how you teach programming

  • @Kratosin2.0
    @Kratosin2.0 10 дней назад

    Thanks! Short and helpful!

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

    You are an excellent instructor!

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

    One of the best tutorials I've seen. I am learning Godot (whose programming language is extremely similar to Python) and this has cleared up a lot! Will subscribe for more. You explained in a way many dont. What's the function? How can you use the function? What's a practical example? You did all of that, nicely done.

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

    This way to explain it's really nice

  • @kspivey88
    @kspivey88 22 дня назад

    nicely explained! thanks!

  • @edikblank3759
    @edikblank3759 Год назад +10

    biggest gigachad because:
    A) Amazing tutorial
    B) Said tutorial is absolutely free
    C) Flat out refuses donations and says no give to a charity
    D) Has the gigachad picture in his pfp

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

    Keep up the good work! You helped me out and now i understand more and better! Thank you

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

    Thank you, that was such a straight forward explanation.

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

    i might actually pass my practical tmrw tysm for this vid

  • @adamartinmusic
    @adamartinmusic 8 месяцев назад +1

    thank you so much for helping. i understand you so well.

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

    bro you helped me with my coding project with this tutorial! Thankyou

  • @niknam.344
    @niknam.344 Месяц назад

    Nice and useful, tnx❤

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

    Thank You!

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

    great video

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

    Really big thanks for your videos. Subbed! Trying to learn python and its not easy when our techer is not the best ;)

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

    Really helpful!

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

    i your videos just clear all my doughts . arigato gozaimasu !!

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

    This episode is really interesting, keep it up!

  • @㐥㐥㐥㐥㐥㐥㐥㐥㐥㐥
    @㐥㐥㐥㐥㐥㐥㐥㐥㐥㐥 Год назад +21

    Can you guys imagine this legend made me master in python, and in school, students of my grade are just learning simple things of python

  • @AkshayKp-wz5dg
    @AkshayKp-wz5dg Месяц назад

    Love from India ❤

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

    thank you i had watched alot of videos and couldnt understand, yet i understand now good day.

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

    thank you

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

    Just started coding, see you in a few years!

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

    High quality content. You win me as a subscriber.

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

    Good vids bro🤞🏽

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

    Thanks

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

    have a sub bro, appreciate your free education and very easy to learn video!

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

    Bro you are the best guy for programming

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

    bro, you're my hero

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

    nice course❤

  • @WINDOWSUSER-q4s
    @WINDOWSUSER-q4s 11 месяцев назад

    NICELY DONE...❤

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

    Good "for" you

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

    you are awesome
    🤩

  • @mythicpulse-i9o
    @mythicpulse-i9o Год назад

    what a nice video

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

    That was helpful
    Thanks 🙏🙏

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

    His videos forces me to think why people even buy paid course. It isn't even like he doesn't incorporate other misc. important stuff aswell. Keep going on Bro!

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

    very useful

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

    Once again great tutorial Bro Code

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

    Thanks bro

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

    question:at 4:22 you have written ''else:'' wich i tried not to write it and see what happens.Nothing changed,so why did you write it (i am asking because of curiosity)

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

    You are awesome

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

    Thank you :)

  • @abdulhannan-18
    @abdulhannan-18 11 месяцев назад +2

    break: breaks the loop at that iteration
    for x in range(1, 21):
    if x == 18:
    break
    print(x, end=' ')
    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
    for x in range(20):
    if x == 18:
    break
    print(x, end=' ')
    0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

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

    hi! can you please tell how to use for i in range (a, b) and write all decimals between a and b please. I don't understand cause a and b can be only integer, how can i write all decimals (that is a float) between a and b? Thank you !

  • @mo-ab7315
    @mo-ab7315 Год назад

    tutorials are so goated

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

    love u bro u make me to understand ❤❤❤❤

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

    1:47 thanks today is my birthday 🥳

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

    great examples

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

    i'm pretty sure the for loop executes faster than the while loop too.

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

    What extension pack are you using to get you VS code layout to look like that?

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

    your the best =))

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

    Thank u so much bro
    Congratulation for 1M subscribers🥳

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

    But can we do that is a set of arrays with timer or wait time in millis and make the different arrays do different things from one another? 😮

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

    thx

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

    Hey question. Im learning how to code with Crunchzilla and I’m trying to get the answer for a specific question which the internet doesn’t answer. In code monster that im using forloop is used too repeat code to make boxes c.fillRect. So they use this code:(i=0; i

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

    Slightly easier way to loop in reverse: `for x in range(10,1,-1):` = `for x in reversed(range1,11)):`

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

    Okay, so a "for" loop is sort of a countdown or timer?

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

    Hey bro I have a doubt . It's from python Gui windows. You told us how to create a new window by clicking a button . My problem is when we created a new window, then How can I get the strings value from Entry boxes in the newly created window?!?! I am stuck in this problem from last 20hrs please help
    .
    I can use the get method for Entry boxes in 1st window but after creating 2nd window i am unable to use the get method on the entry boxes of window 2 :(

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

    Can you tell me how you have two screens

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

    Thank you Benson Adventure Time!

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

    you rock Bro!

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

    hey whats an itiration i need some simple definiton

  • @jenis-01
    @jenis-01 2 года назад

    can you please make data structure algorithm course for C++? Please!!!!

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

    👏

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

    what IDE are you using?

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

    MERN app development?
    I am having trouble with npm cuz they loads too much files
    Can you make course on how to set up mern app development

  • @buffoonoutdoors
    @buffoonoutdoors 14 дней назад

    print ("Thank you")

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

    thanks for distracting me from ninjago overture theme that has been stuck in my head for hours. i am a c++ programmer but i want to learn python so i know complicated languages.

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

    """
    Here I have added while loop in the nested for loops
    So if the user type a letter or a number, it will ask you to type a symbol instead
    Yes I have changed the variable from rows and columns to length and breadth respectively to relate this code more to Math
    """
    #Print a rectangle using symbols
    print("Rectangle using symbols")
    length = int(input("Enter number of symbols you want horizontally: "))
    breadth = int(input("Enter the number of symbols you want vertically: "))
    symbol = str(input("Enter the symbol: "))
    for x in range(breadth):
    for y in range(length):
    while symbol.isalpha() or symbol.isdigit():
    # While condition if the user type any letter or number then the loop will run
    symbol = str(input("Enter the symbol not a letter from alphabet or a number: "))
    print(symbol, end="")
    print()

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

    Heyy , Can you upload Full stack MERN web development course ?? Please 🥺

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

    So if we want to use for loop on a list, do we turn the list into strings with .str() after the list

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

      To turn a list into a string you use:
      newString = "".join(your_list)

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

      yes just go like this cars = ("Mercedes", "Audi", "BMW")
      for car in cars:
      print(car)

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

    Coming from Java, Python is heck confusing for me.
    I understand other C based languages such as C# and C++ better 😅

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

      Tbf,
      Java, C# and C++
      are like the children of C
      so Python will feel alot different 🤔
      Can't jump into OOP right away

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

    #while loops = Used to execute loops infinite amount of times.
    #for loops = used to execute loops a fixed number of times.

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

    Para mim, é o contrário, haha. Tenho pouca paciência ao aprender coisas e acabo interrompendo o curso frequentemente para me envolver em projetos.

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

    question: if I have a directory with a different number of items in each, how can I loop to access each item from 1st item to last/max item?

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

      maybe you can use a [for item in 'name of the directory']

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

      @@Arsen_winning_way I ended up using - len(file_paths) - to determine the number, then created a range with len being the max and looped it with a file position command.

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

    i didn´t understand this thank you

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

    Is "continue" really used for skipping?

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

    why do I feel guilty for not paying and getting this for free. No cap 10x btr than most payed python courses

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

    hey

  • @J0v0756
    @J0v0756 22 дня назад

    Ya think?!?

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

    duuuuudeee how do i run 2 lines of code in the same for loop lets say i wannna add a number to x 10 times and print it hapy 10 times in the same for loop

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

      It's the same way that he printed happy new year.

  • @bruhhh.77
    @bruhhh.77 Год назад

    I fkin love you

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

    Why in the world they decided to use "continue" instead of "skip". I hope skip does something that makes more sense, otherwise this is utterly meaningless.

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

      I guess because in practical use or exception handling, you use it when you get an exception.
      After detecting the exception, the program handles it and *_continues_* without crashing.
      It's the same keyword in other languages.

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

    number 13 is an orphan😂😂😂😂

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

    Hmmmm we need matlab in my Engineering college.

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

    Proud to be 5th commenter

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

    Bro code is always bro friendly -_-