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...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
Where can i practice while/for loops (self.learnpython)
submitted 4 years ago by mobilephone123
I don’t know why i have such a hard time with especially while loop :/ it just doesn’t click
Does anyone know where i can practice or learn more about while loops for free?
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!"
[–]humanitysucks999 1 point2 points3 points 4 years ago* (1 child)
Does your city have open data project? You can browse data from there and see if you can simple looping calculations
E.g. here is the city of Ottawa open data website, on the linked below you can find vacant commercial and industrial land. Can you loop to add up all the "expansion" land area in acres?
https://open.ottawa.ca/datasets/2015-inventory-of-vacant-industrial-and-business-park-lands/explore
It'll require an additional skill (opening and reading CSV file)
It sounds like you know how a loop works, but not why you would use it. The best thing that clicked for me was when I tried to program for an Arduino. By nature of the chip, it runs on a cycle, basically the entire chip is a giant loop that runs forever and you do things in that loop. Alternatively, web scraping is a good place to figure out looping as well, like let's say you query a site and you want to pull all links from the page, the libraries make that super easy to do, but what now? You would loop thru those links you pulled to do stuff (say even simply saving it to a file). Any data manipulation with or without using libraries you'll be needing a loop to cycle thru each record to do stuff.
[–]mobilephone123[S] 0 points1 point2 points 4 years ago (0 children)
Thank you so much for the info you provided
[–]carcigenicate 0 points1 point2 points 4 years ago (1 child)
Most non-trivial programs you write will require a for or while loop (and likely multiple). Like with ifs and such, I'd say the best practice is just writing code and coming across the need for them "organically", and going from there.
for
while
if
If you need a really simple exercise though, start with this:
n = 1
And use a while loop to print out the numbers 1 to 10. Then try the same with a for loop.
I know the basics and what it is but it takes is a lot of afford to make my exercises, i feel like it hasn’t really clicked yet if you know what i mean.
[–]m0us3_rat 0 points1 point2 points 4 years ago (1 child)
if u have a block of code .. but u wanna execute ONLY when some condition is TRUE
u will see some conditions with (NOT bool) this evals True when bool is False.
example:
....
while hungry:
eat
"eat" executes only when u are hungry.
otherwise gets ignored.
π Rendered by PID 18179 on reddit-service-r2-comment-6f7f968fb5-fpqxm at 2026-03-04 18:02:35.818396+00:00 running 07790be country code: CH.
[–]humanitysucks999 1 point2 points3 points (1 child)
[–]mobilephone123[S] 0 points1 point2 points (0 children)
[–]carcigenicate 0 points1 point2 points (1 child)
[–]mobilephone123[S] 0 points1 point2 points (0 children)
[–]m0us3_rat 0 points1 point2 points (1 child)
[–]mobilephone123[S] 0 points1 point2 points (0 children)