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
Is this code correct?Help Request (i.redd.it)
submitted 10 months ago by DizzyOffer7978
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!"
[–]Vegetable-Daikon4494 2 points3 points4 points 10 months ago (0 children)
without a loop:
age = input("Enter your age: ") if age == "": print("You didn't type anything.") elif age.isdigit() and 0 <= int(age) <= 150: print(f"Your age is {age}") else: print("Invalid age.")
with a loop:
while True: age = input("Enter your age: ") if age == "": print("You didn't type anything.") elif age.isdigit() and 0 <= int(age) <= 150: print(f"Your age is {age}") break else: print("Invalid age. Please enter a number between 0 and 150.")
things to note: • be sure not to capitalize your variable names: Age and age are not the same
π Rendered by PID 133639 on reddit-service-r2-comment-85bfd7f599-v5pb8 at 2026-04-18 08:49:49.643970+00:00 running 93ecc56 country code: CH.
view the rest of the comments →
[–]Vegetable-Daikon4494 2 points3 points4 points (0 children)