Nested loops in Python are easy ➿

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ก.ย. 2024
  • #Python #course #tutorial
    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()

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

  • @BroCodez
    @BroCodez  ปีที่แล้ว +85

    # 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()

  • @Lex_Marion
    @Lex_Marion ปีที่แล้ว +399

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

      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 11 หลายเดือนก่อน +1

      Yeah me too😢

    • @Frail-pg8xt
      @Frail-pg8xt 11 หลายเดือนก่อน +1

      Same condition for everyone else. No one just realises it

  • @cdkw8254
    @cdkw8254 ปีที่แล้ว +32

    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 11 หลายเดือนก่อน +16

    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!

    • @mask09499
      @mask09499 8 หลายเดือนก่อน +1

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

  • @harleenkaur2096
    @harleenkaur2096 ปีที่แล้ว +22

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

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

  • @RominiyiOmodona
    @RominiyiOmodona 2 หลายเดือนก่อน +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

  • @Narree-61
    @Narree-61 หลายเดือนก่อน

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

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

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

  • @jeiddoromal4804
    @jeiddoromal4804 3 หลายเดือนก่อน

    clear explanation, helped and saved my brain from overthinking

  • @krosarian
    @krosarian 11 หลายเดือนก่อน +3

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

    • @user-th2js2nv3f
      @user-th2js2nv3f 10 หลายเดือนก่อน

      3 days now, still dont fully understand it

    • @krosarian
      @krosarian 10 หลายเดือนก่อน +5

      @@user-th2js2nv3f 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 7 หลายเดือนก่อน +1

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

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

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

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

    Now I understand nexted loop better👏✔️

  • @mariakoszalin
    @mariakoszalin 2 หลายเดือนก่อน

    best explanation of nested loops out there

  • @gamisr2848
    @gamisr2848 7 หลายเดือนก่อน

    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 7 หลายเดือนก่อน +1

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

  • @yonisapir6270
    @yonisapir6270 ปีที่แล้ว +5

    Perfectly explained, thank you!

  • @RameshKumar-ng3nf
    @RameshKumar-ng3nf 6 หลายเดือนก่อน

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

  • @K4113B4113
    @K4113B4113 5 ชั่วโมงที่ผ่านมา

    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.

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

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

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

    Thanks bro, you explain them really well

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

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

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

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

  • @godxdestructionyt6173
    @godxdestructionyt6173 6 หลายเดือนก่อน +1

    Thanks 😊

  • @reincarnationofthelightking
    @reincarnationofthelightking 9 วันที่ผ่านมา

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

  • @MrP-jg3cc
    @MrP-jg3cc ปีที่แล้ว +4

    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 4 หลายเดือนก่อน +1

      It’s never too late

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

    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

  • @CarlosLopez-mx8hq
    @CarlosLopez-mx8hq 2 หลายเดือนก่อน

    Dude i fking love u, ur content is outstanding

  • @Compuscience-Python-Prog-Exps
    @Compuscience-Python-Prog-Exps ปีที่แล้ว

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

  • @bobaayla
    @bobaayla 9 หลายเดือนก่อน

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

  • @markrose805
    @markrose805 9 หลายเดือนก่อน

    You’re awesome man! Thanks

  • @destinydie
    @destinydie 2 หลายเดือนก่อน

    Thanks for the wonderful video...

  • @user-ky9cq3th8e
    @user-ky9cq3th8e 9 หลายเดือนก่อน +1

    Thank you so much sir

  • @HassanRaza-pe5rh
    @HassanRaza-pe5rh ปีที่แล้ว +1

    Very clearly explained bro! Thanks!

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

    I finally see the light!😀

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

    thanks for your explanation it's really helpful ☺

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

    Thank you sir for your help..

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

    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.

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

    Thank you so much for this

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

    excellent vid. really well explained. thanks

  • @alivee9496
    @alivee9496 15 วันที่ผ่านมา

    you are awesome

  • @Louviewtube
    @Louviewtube 9 หลายเดือนก่อน

    Brilliant. Thank you.

  • @MrDarkplace22
    @MrDarkplace22 3 หลายเดือนก่อน

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

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

    very helpful thanks

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

    awesome content as always, thanks Bro!👌

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

    Wow !! super expalination !@

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

    You are the best!!!!!

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

    you're awesome

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

    respect Teacher.
    @Bro Code

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

    Thx 4 vid bro !

  • @Raja-tt4ll
    @Raja-tt4ll 7 หลายเดือนก่อน

    Very nice

  • @senpaigt911
    @senpaigt911 ปีที่แล้ว +17

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

  • @artemblinkov2241
    @artemblinkov2241 9 หลายเดือนก่อน

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

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

    Thank you❤

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

    THANK YOU SO MUCH

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

    man i love you thx

  • @KeremLBJ
    @KeremLBJ 10 หลายเดือนก่อน

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

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

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

  • @Mario-if5tl
    @Mario-if5tl ปีที่แล้ว

    Good job 👍

  • @chalanagimhana8275
    @chalanagimhana8275 7 หลายเดือนก่อน

    you are the best

  • @user-dj7ic1xs2p
    @user-dj7ic1xs2p ปีที่แล้ว +1

    a loop inside of an another loop outer loop inner loop

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

    v v good. ty ❤

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

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

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

    Tq so much

  • @pubudinijayawardana3801
    @pubudinijayawardana3801 3 หลายเดือนก่อน

    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.

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

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

  • @sumfatt640
    @sumfatt640 10 หลายเดือนก่อน

    thnx , with anki flashcards would be cool to memorize

  • @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 7 หลายเดือนก่อน

    Thank You make it simple bro codez

  • @AK-Star007
    @AK-Star007 ปีที่แล้ว +2

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

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

      I think you mean \t

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

    damn ur awesome

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

    Can u make it in one line please?

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

    Very well explained, thank you!

  • @LoyisoMsweli
    @LoyisoMsweli 24 วันที่ผ่านมา

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

  • @Muhammad-ul8on
    @Muhammad-ul8on ปีที่แล้ว +1

    Chad 🗿 explanation

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

    This is so easy

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

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

  • @DipanshuAgarwal-q2q
    @DipanshuAgarwal-q2q หลายเดือนก่อน

    Bro pls tell which site u use

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

    tini paduko

  • @smedge4048
    @smedge4048 7 หลายเดือนก่อน

    X is a counter. What is a counter?

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

      Watch the video on for loops

  • @ramazanyetismis192
    @ramazanyetismis192 9 หลายเดือนก่อน

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

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

    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?

  • @karnikabaroniya
    @karnikabaroniya 9 หลายเดือนก่อน

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

  • @merwanmohammed8332
    @merwanmohammed8332 10 หลายเดือนก่อน

    i think you mistaken row for column and column for row

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

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

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

    Wher full rust tutorial

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

    ❤❤😊😊

  • @ElyamineFahardine-bi8md
    @ElyamineFahardine-bi8md 8 หลายเดือนก่อน

    Which app do u use to program?

    • @AyuPlus
      @AyuPlus 5 หลายเดือนก่อน +1

      PyCharm

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

    a = int(input("Enter the # of rows: "))
    b = int(input("Enter the # of columns: "))
    symbol = input("Enter a symbol to use: ")
    for i in range(a):
    print(symbol*b, end="
    ")

  • @pujeetjha8265
    @pujeetjha8265 2 หลายเดือนก่อน

    Loop de loop

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

    4:54
    That’s not a rectangle

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

    Make sense

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

    bro which idle do u use

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

      Pycharm

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

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

    Arigatō aniki!

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

    its feels like i a

  • @JoaoPedro-vf1ke
    @JoaoPedro-vf1ke ปีที่แล้ว

    hello bro, hope you're doing well

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

  • @tauhidalam-8143
    @tauhidalam-8143 ปีที่แล้ว

    what does the 'end' command do?

    • @fuzzylogics139
      @fuzzylogics139 10 หลายเดือนก่อน +1

      Your comment is a month old but if you have not yet figured it out (or if someone else is reading your comment and wondering the same thing: it tells the program to print all the numbers on the same line:
      1234567
      1234567
      1234567
      Otherwise it would put each number on a new line
      1
      2
      3
      4
      5
      6
      7
      1
      2
      3
      4
      5
      6
      7
      1
      2
      3
      4
      5
      6
      7
      And if you would put a space between the parentheses it will put a space between the numbers: 1 2 3 4 5 6 7
      You can just experiment with what happens when you do not put the ,end=" " there then you will see

    • @tauhidalam-8143
      @tauhidalam-8143 10 หลายเดือนก่อน +1

      @@fuzzylogics139 Thank you bro before that i had a vague idea what it did now its clear

    • @fuzzylogics139
      @fuzzylogics139 10 หลายเดือนก่อน

      Great! :) @@tauhidalam-8143

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

  • @boglin
    @boglin 6 หลายเดือนก่อน +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 5 หลายเดือนก่อน

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

    • @Derp-Dylan12
      @Derp-Dylan12 5 หลายเดือนก่อน

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

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

    dont get it