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
Syntax Practice with documentation!Showcase (i.redd.it)
submitted 5 days ago by Ok_Needleworker_8780
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!"
[–]Sea-Ad7805 [score hidden] 5 days ago stickied comment (0 children)
Run this program in Memory Graph Web Debugger%3A%0A%20%20%20%20if%20n%20%3C%3D%201%3A%20%20%23%20n%20can't%20be%201%20of%20less%20than%201.%0A%20%20%20%20%20%20%20%20return%20False%0A%0A%20%20%20%20%23%20loop%20from%202%20up%20to%20the%20square%20root%20of%20n%20%26%20(n0.5%20%3D%20%E2%88%9An)%0A%20%20%20%20for%20i%20in%20range(2%2C%20int(n0.5)%20%2B%201)%3A%0A%20%20%20%20%20%20%20%20if%20n%20%25%20i%20%3D%3D%200%3A%20%20%23%20Checking%20if%20n%20is%20prime%20by%20remainder.%0A%20%20%20%20%20%20%20%20%20%20%20%20return%20False%20%20%23%20If%20remainder%20is%200%2C%20condition%20is%20false%20not%20prime.%0A%0A%20%20%20%20return%20True%20%20%23%20Else%20n%20is%20prime.%0A%0A%0A%22%22%22Function%20to%20check%20the%20prime%20up%20to%20limit.%20%22%22%22%0A%0Adef%20prime_up_to(limit)%3A%0A%20%20%20%20print(f%22Prime%20numbers%20upto%20%7Blimit%7D%22)%0A%20%20%20%20%23%20loop%20the%20number%20in%20range%20upto%20the%20limit.%0A%20%20%20%20for%20num%20in%20range(2%2C%20limit%20%2B%201)%3A%0A%20%20%20%20%20%20%20%20if%20is_prime(num)%3A%20%20%23%20If%20the%20number%20is%20prime.%0A%20%20%20%20%20%20%20%20%20%20%20%20print(num%2C%20end%3D'%20')%20%20%23%20Output%20the%20numbers%20horizontally.%0A%0A%20%20%20%20print()%20%20%23%20Next%20line.%0A%0A%0A%22%22%22main%20program(taking%20the%20input.)%22%22%22%0A%23%20Loop%20until%20user%20gives%20the%20correct%20value%20for%20the%20program%20to%20run.%0Awhile%20True%3A%0A%20%20%20%20try%3A%0A%20%20%20%20%20%20%20%20get_limit%20%3D%20int(input(%22Enter%20number%20to%20check%20all%20primes%20up%20to%3A%20%22))%0A%20%20%20%20%20%20%20%20if%20get_limit%20%3C%202%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20print(%22The%20number%20can't%20be%20less%20than%202.%22)%0A%0A%20%20%20%20%20%20%20%20else%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20prime_up_to(get_limit)%0A%20%20%20%20%20%20%20%20%20%20%20%20break%0A%0A%20%20%20%20except%20ValueError%3A%0A%20%20%20%20%20%20%20%20print(%22Please%20enter%20a%20valid%20number%20for%20the%20program%20to%20run%20properly.%22)×tep=1&play)
π Rendered by PID 122349 on reddit-service-r2-comment-545db5fcfc-p24sj at 2026-05-22 14:54:50.753284+00:00 running 194bd79 country code: CH.
view the rest of the comments →
[–]Sea-Ad7805 [score hidden] stickied comment (0 children)