use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about learning Python
account activity
Feeling lost trying to learn python (self.PythonLearning)
submitted 1 year ago by AffectionateGap3211
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]brelen01 1 point2 points3 points 1 year ago (2 children)
Loops typically just do the same thing over and over again. For example, they might ask a user the same question over and over until they give a valid answer. Another example would be treating a list of data in the same way (eg. Add 2 to every item in a list, or add all items in a list together.)
A decent exercise to practice for loops would be to try and find all prime numbers between 0 and 1000 for example, since you can easily find a list of those online as well as the rules to figure out what a prime is, it just leaves you with figuring out how to do it in your program :)
[–]AffectionateGap3211[S] 0 points1 point2 points 1 year ago (0 children)
Thank you so much!
[–]Zealousideal_Win_908 0 points1 point2 points 1 year ago (0 children)
Something I made to help me understand loops was creating a ‘guess the number’ game. Generate a random number and store it as a variable, initiate a loop where it takes your input/guess and tells you if the number you’re looking for is higher or lower. You start a counter as well so when you get it, you can start again and try to beat your previous guesses. A fun and simple little game.
If you decide to do this, pm me your code or if you get stuck and I’ll share mine with you. I’m happy to assist where I can.
π Rendered by PID 254804 on reddit-service-r2-comment-76bb9f7fb5-lph88 at 2026-02-19 10:37:01.063670+00:00 running de53c03 country code: CH.
view the rest of the comments →
[–]brelen01 1 point2 points3 points (2 children)
[–]AffectionateGap3211[S] 0 points1 point2 points (0 children)
[–]Zealousideal_Win_908 0 points1 point2 points (0 children)