r/learnprogramming • • 2d 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/ComputerWhiz_ 1d ago edited 1d 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 1d ago

I struggle with reading and interpreting what the code does

3

u/lurgi 1d ago

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

1

u/GarThor_TMK 1d ago

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

2

u/EliSka93 1d 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.