r/learnprogramming • • 6d 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?

8 Upvotes

37 comments sorted by

View all comments

1

u/ComputerWhiz_ 6d ago edited 6d ago

Don't get too hung up on the technical element of the concept, try to understand the concept first. Applying the concept to something in real life can be helpful.

For example, reading a book is a nested loop. You have one loop that flips through each page and an inner loop that reads each line on the page and an even more inner loop that reads each word on a line.

Another example, rolling dice until you get the number 6 is a while loop. If you didn't roll a 6, roll again, and repeat.

Is there a specific part about nested loops and while loops that you struggle with?

1

u/MacaroonSerious5532 6d ago

I struggle with reading and interpreting what the code does

3

u/lurgi 6d ago

Type it into a computer. Put print statements into the code that show the value of useful variables.

1

u/GarThor_TMK 5d ago

And then set breakpoints and step through what the program is doing slowly.

2

u/EliSka93 6d ago

I think most people do for a while.

I know I used to.

The more you practice, the more that feeling goes away.

Don't let it discourage you, it does get better.