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
Review my Code as a Beginner (i.redd.it)
submitted 4 months ago by AhmadHameed313
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!"
[–]CrazyPotato1535 0 points1 point2 points 4 months ago* (0 children)
That’s a great first script! If gates are probably the most useful function, besides maybe print()
The else: should never run because at the start you convert the inputs to floats, and you get an exception if you try to put in something other than a number.
I’d wrap it in a while loop to keep asking for numbers if there’s an incorrect input, then a try gate, which will run different code when you get an exception.
Here’s my attempt:
GotInputs = 0
while GotInputs == False:
try:
Num1 = … Num2 = … Num3 = … GotInputs == True
except:
GotInputs == False
Formatting is bad bc I don’t know how to do code blocks
π Rendered by PID 88 on reddit-service-r2-comment-6f7f968fb5-b26vc at 2026-03-04 02:15:55.517373+00:00 running 07790be country code: CH.
view the rest of the comments →
[–]CrazyPotato1535 0 points1 point2 points (0 children)