Nested loops in Python are easy ➿

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

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

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

    # nested loop = A loop within another loop (outer, inner)
    # outer loop:
    # inner loop:
    rows = int(input("Enter the # of rows: "))
    columns = int(input("Enter the # of columns: "))
    symbol = input("Enter a symbol to use: ")
    for x in range(rows):
    for y in range(columns):
    print(symbol, end="")
    print()

    • @mondlistyleman9389
      @mondlistyleman9389 Год назад +5

      You're my hero... Love from South Africa :)

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

      There’s a little typo in the code, columns go horizontal so the outer loop in this case represents the columns and inner loop is the rows

  • @Lex_Marion
    @Lex_Marion Год назад +491

    I don't know why but my brain really, REALLY wants to overthink both for loops and nested loops. They're really simple concepts but something always gets wonky in the monkey wires. This was a great video, really needed something to explain it in the most babymode 5 year old way, thank you

    • @gerardogodinez6919
      @gerardogodinez6919 Год назад +23

      Same happens to me

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

      Its a completely opposite for me tho i need more in depth explanation

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

      I thought I was the only one

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

      Yeah me too😢

    • @Frail-pg8xt
      @Frail-pg8xt Год назад +1

      Same condition for everyone else. No one just realises it

  • @cdkw8254
    @cdkw8254 Год назад +49

    Bro, you saved me ass, I was gonna fail for sure but you absolute ultimate gigachad saved my. Thank you King. You dropped this 👑

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

    THAT IS SO WELL THOUGHT OUT! BRILLIANT! AND I AM STARTING TO UNDERTAND HOW PROGRAMMERS THINK AND DEVELOP THEIR PROGRAMS! THANK YOU SO MUCH FOR ALL YOUR TUTORIALS!

    • @maskie.maskie
      @maskie.maskie 11 месяцев назад +1

      U are the best🥲, u are supposed to be a lecture😏

  • @harleenkaur2096
    @harleenkaur2096 Год назад +23

    Thank you much
    This is the first time I have understood nested loops, pattern after watching so many videos
    God bless
    Please keep making more videos on programming

  • @jaspersumugat6951
    @jaspersumugat6951 2 года назад +11

    This is very clever and give me a better understanding in nested loop

  • @Narree-61
    @Narree-61 4 месяца назад +1

    This guy is one of my favorite people on Earth. I don't even know who you are but you are 100% a king

  • @rossmarvin6078
    @rossmarvin6078 День назад

    Aaah!!! It's all clicked in my head now. Thanks man!

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

    clear explanation, helped and saved my brain from overthinking

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

    First semester CS student. Nested loops confused the hell out of me in class last week. This video helped clear some of the confusion. Much appreciated!

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

      Also a first semester CS student, was totally lost. Hoping this video helps. Will watch when I get home from my lecture.

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

    I have my a levels computer science exam tomorrow and you just saved my life

  • @yonisapir6270
    @yonisapir6270 2 года назад +5

    Perfectly explained, thank you!

  • @krosarian
    @krosarian Год назад +3

    took me about an hour but finally I understand nested loops, thank you Bro Code

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

      3 days now, still dont fully understand it

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

      @@NorfaizahMatLui take your time, what worked for me was writing it on a whiteboard, and trying to explain it with my own words, if you think about it it's like multiplication:
      For n in range(3)
      For z in range(5)
      Print("hello")
      The first for loop will tell you how many times the next loop will be done, in this case 3, and then the second loop, will print 5 "hello":
      Hello hello hello hello hello
      Hello hello hello hello hello
      Hello hello hello hello hello
      You printed 5 hello's, 3 times

    • @banane442
      @banane442 10 месяцев назад +1

      @@krosarian that´s actually a pretty good. thx man

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

      @@krosarian Buddy to print what you wrote:
      for i in range(3):
      for k in range(5):
      print("hello", end="")
      print()
      Hope yer fine.

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

    you are a blessing to me dude !

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

    best explanation of nested loops out there

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

    Thanks for the explanation really needed it I was literally going mad trying to understand it on my own not know that it is not that deep

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

    Thanks for the wonderful video...

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

    Now I understand nexted loop better👏✔️

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

    You entirely clear my concept ... thanks alot bro 😭😭🤌

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

    Thank you sir for your help..

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

    I clearly understand now but I tried it several times, it gives me syntax error I do not know what is wrong

  • @Zenderlife
    @Zenderlife 9 дней назад

    idk why i was so confused on nested loops to start out with now

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

    Thanks bro, you explain them really well

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

    This is a life saver video I have my exam tomorrow so thank u so much

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

    Thank you bro for all your videos. I Iearnt java and javascript extensively through your videos.

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

    You’re awesome man! Thanks

  • @Compuscience-Python-Prog-Exps
    @Compuscience-Python-Prog-Exps Год назад

    Thank so very much for your help on leaning Python .. Great, to the point Teacher.

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

    Bro, may I say you have such a soothing and beautiful voice? 🤗

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

    great video bro .love from INDIA🧡🤍💚

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

    thanks for your explanation it's really helpful ☺

  • @Muhammadbilalnawaz-f6r
    @Muhammadbilalnawaz-f6r Год назад +1

    Thank you so much sir

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

    Thx bro for the good explanation I have an exam tomorrow and I didn’t understand nested loops bcz the explanation in the digital book that the school gave me was CONFUSING AND COMPLICATED

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

    Super content and editing

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

    excellent vid. really well explained. thanks

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

    Man I could barely understand a word my programmer teacher said during the entire semester. He had this really thick south-asian accent. Took me several lessons to understand that he was saying "unicode" and not "unicorn", let alone understanding what unicode is. The language was Java which is a bit unintuitive compared to Python and the course book was this 600 pages, dull, black and white textbook that I couldn't muster any motivation to read multiple pages out of.
    Somehow I managed to get the highest grade in Programming 101 and the second highest in Programming 102 (I think the teacher was overly nice and just gave out good grades). The end result was that I didn't feel like I understood anything about programming whatsoever despite what my grade sheet said. For some reason I've had a really negative or hopeless attitude towards programming ever since. What I'm trying to say is: these videos are great.

  • @CarlosLopez-mx8hq
    @CarlosLopez-mx8hq 5 месяцев назад

    Dude i fking love u, ur content is outstanding

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

    ahhh this is soo baffling, my brain cannot comprehend this idea

  • @HassanRaza-pe5rh
    @HassanRaza-pe5rh Год назад +1

    Very clearly explained bro! Thanks!

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

    Wow !! super expalination !@

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

    I finally see the light!😀

  • @Raja-tt4ll
    @Raja-tt4ll 9 месяцев назад

    Very nice

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

    Brilliant. Thank you.

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

    You are the best!!!!!

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

    very helpful thanks

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

    Thank you so much for this

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

    Bro youre amazing thank you

  • @MrP-jg3cc
    @MrP-jg3cc Год назад +6

    Hey bro I'm new to python, I just want to kick start my career I'm 23 now, is it ok to learn python from basics., Bcz I feel aged for programming..

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

      It’s never too late

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

      Did you got it bro?

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

    you are awesome

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

    Bro saved me from failing in my class 11th practical exams 🙏🏽🙏🏽🙃

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

    Thx 4 vid bro !

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

    this guy tptally sounds like ryan george from pitch meeting , also thanks for your video made a complex topic so simple

  • @mohammadsahirrangrez8525
    @mohammadsahirrangrez8525 21 день назад

    bro you are my G

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

    do you have a matrix done ? That would be great !

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

    sir how can I use this expression in python for nested loops? val= int(input()) inputs are 2 and 5. and output should be * mark as rectangle shape. Please explain. Thank you.

  • @Mario-if5tl
    @Mario-if5tl Год назад

    Good job 👍

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

    So I'm doing exactly this but for some reason it's shorting me a symbol at the end.

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

    Can u make it in one line please?

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

    you're awesome

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

    awesome content as always, thanks Bro!👌

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

    Can you make a tutorial how to delete system32 with python ?

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

      no lol

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

      @@BroCodez Ok =l

    • @ElwinJoby
      @ElwinJoby 17 дней назад +1

      Here is the code. Replace the placeholders with your file name and path import os
      def delete_test_file(file_path):
      try:
      if os.path.exists(file_path):
      os.remove(file_path)
      print(f"File {file_path} deleted.")
      else:
      print(f"File {file_path} does not exist.")
      except Exception as e:
      print(f"Error: {e}")
      # Test path to a non-essential file
      delete_test_file("C:/path/to/non/critical/test/file.txt")

    • @Jggapp016
      @Jggapp016 17 дней назад +1

      @@ElwinJoby Hey thank you !🥰🥰

    • @dankbruhnco1765
      @dankbruhnco1765 17 дней назад +1

      ​@@ElwinJoby What have you done

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

    Yes this is easy but there are programs that go like the output should be like the following
    *
    * * *
    * * * * *
    * * *
    *
    or like
    *
    * *
    * *
    * *
    *
    can you make a video on how to do them please

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

    you are the best

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

    Really loved the explanations, thanks! One question, how would the code look like if I wanted to make a triangle tho?

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

    thnx , with anki flashcards would be cool to memorize

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

    respect Teacher.
    @Bro Code

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

    I didn't like the appearance of having a period after the last number in the iteration, so I wanted to change how it looks. But I also wanted to avoid hard-coding it to be the exact number '9'. Here is the solution I came up with, using the str.join() method:
    for x in range(3):
    sequence = range(1, 10)
    last_number = list(sequence)[-1]
    numbers = [str(y) if y != last_number else str(y) for y in sequence]
    print(".".join(numbers))

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

    man i love you thx

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

    THANK YOU SO MUCH

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

    I have watched multiple videos, trying to understand nested loops and this video finally made sense to me! Thanks for breaking this down in such an easy way.

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

    "SAVED, I'M SAVED"

  • @RameshKumar-ng3nf
    @RameshKumar-ng3nf 9 месяцев назад

    Such a beautiful explanation Sir. Thanks a lot for sharing making it easy to understand for beginners.

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

    My thing and im in my 3rd werk for python is when I'm reading or watching this material i understand it, but i have an issue seeifn where you use it. Maybe this comes along once you understand all the fundamentals concretely bc i sure as hell don't yet. But this leads to massive overthinking on my part.
    Like, i have a simple site written in simple html/css. I have made a database in docker with MSSQL, and i want to make a python application to get the data from the DB and display it on the webpage. In very generic terms this is the "stack" im looking for no?

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

    Hey Bro code, do you have an example of a text based game in python??

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

    Thank you

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

    Thank you❤

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

    after first loop can we write print(symbol * columns ) and finish the code ?

  • @AyushSharma-cs8yv
    @AyushSharma-cs8yv Месяц назад

    Thankyou❤

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

    v v good. ty ❤

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

    Tq so much

  • @AK-Star007
    @AK-Star007 Год назад +2

    end="/t"
    Will make your result like a table

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

      I think you mean \t

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

    can someone tell me how to get this type of window in python with the program result at the bottom

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

    Wher full rust tutorial

  • @extendedsomeone
    @extendedsomeone 10 дней назад

    #shapemakerproject ➿
    rows = int(input("Enter the number of rows :"))
    columns = int(input("Enter the number of columns :"))
    symbol = input("Enter a symbol to use :")
    for x in range(rows) :
    for y in range (columns):
    print(symbol, end="")
    print()

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

    a loop inside of an another loop outer loop inner loop

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

    haha, valeu amigo.
    Estou fazendo um curso qui no Brasil usam essa refêrencia para ensinar for in range.
    Vou ver mais aulas, não compreendo inglês, mas entendo o código.

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

    Thank You make it simple bro codez

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

    Very well explained, thank you!

  • @Mr.chunker
    @Mr.chunker 4 дня назад

    I love you dawg not in a gay way but this vid saved my ass I was having trouble with for loops cause it was a bit confusing to me, then I saw this vid and I understand now. Thanks you got a new subscriber

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

    Bro can you make a Kotlin tutorial?
    I crash course your Java andddddd employers seeks Kotlin....

  • @DipanshuAgarwal-q2q
    @DipanshuAgarwal-q2q 3 месяца назад

    Bro pls tell which site u use

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

    X is a counter. What is a counter?

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

      Watch the video on for loops

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

    damn ur awesome

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

    ❤❤😊😊

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

    This is so easy

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

    this just doesnt click with me at all, this is the hardest concept so far. im hitting a wall and its only week 3. fml

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

      The outside loop indicates how many times we do the inside loop.

    • @Derp-Dylan12
      @Derp-Dylan12 7 месяцев назад

      Same I understand it on paper but once I try to do anything I get confused

  • @Muhammad-ul8on
    @Muhammad-ul8on Год назад +1

    Chad 🗿 explanation

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

    i think you mistaken row for column and column for row

  • @ElyamineFahardine-bi8md
    @ElyamineFahardine-bi8md 11 месяцев назад

    Which app do u use to program?

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

      PyCharm

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

    tini paduko

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

    can you please explain this question
    Ask the users favorite color and if it is a rainbow color print the color two times and if the color is not a rainbow color print all the even numbers before the birthdate of the user