r/learnprogramming • • 1d ago

Please help

I just hate myself, i cannot figure out nested loops and while loops. Python is the easiest language and I’m struggling so much. I wish i was smart as other people. Does anyone have coding resources for dummies?

7 Upvotes

36 comments sorted by

View all comments

1

u/Stock_Test2326 1d ago

fellow learner

while loops keep on running until the condition is true, or you break them with some conditional logic inside [while { if true/false{ break}}]

in nested loop, for every loop of the outer loop the inner loop runs as many time (sorry am bad at English)

like if you are looping with dictionaries

{a:3, b:2}

lets assume alphabets is for outer loop and number is for how many times inner loop should loop

outer loop runs twice, once for a and once for b.
but inner loop runs 3 times for a and 2 times for b

like

outer loop a
>> inner loop 1
>> inner loop 2
>> inner loop 3
then
outer loop b
>>inner loop 1
>>inner loop 2