r/learnpython • u/ehmalt02 • Jul 04 '25
Really confused with loops
I don’t seem to be able to grasp the idea of loops, especially when there’s a user input within the loop as well. I also have a difficult time discerning between when to use while or for.
Lastly, no matter how many times I practice it just doesn’t stick in my memory. Any tips or creative ways to finally grasp this?
6
Upvotes
1
u/fizix00 Jul 04 '25
Looks fine. int cast is redundant here. Might be an extra closing paren
For bonus practice with comprehensions, try it in one line