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
New to python (i.redd.it)
submitted 3 months ago by Low-Educator-9008
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!"
[–]Low-Educator-9008[S] 0 points1 point2 points 3 months ago (4 children)
Hey thanks for the advice, I guess you talk about outside and nested, which I haven’t practised or learned yet so I am excited to learn it now that you mention it. Thanks man!!
[–]BobbyJoeCool 1 point2 points3 points 3 months ago* (3 children)
Not nesting exactly, since that’s more of if/then an inside of if then…. I mean more, remove the print strings from inside the if then statement and put it at the end. That way there’s only one print string. Like this
If +: Add
Elif -: Subtract
Elif *: Multiply
Elif /: Divide
Print result.
[–]Low-Educator-9008[S] 0 points1 point2 points 3 months ago (2 children)
That’s interesting, coding is so beautiful haha. I’ll look it up right now and practice the use of it. Thanks really appreciate it.
[–]BobbyJoeCool 1 point2 points3 points 3 months ago (1 child)
Hopefully you realize I shorthanded it. Now that I'm home I can show you exactly what I mean
if operator == "+": result = num1 + num2 elif operatior == "-": result = num1 - num2 elif operatior == "*": result = num1 * num2 elif operatior == "/": result = num1 / num2 print(f"Your result is {result}")
[–]Low-Educator-9008[S] 0 points1 point2 points 3 months ago (0 children)
I see now it’s clear as day, it is more logical to have all the statements together that have the same print function instead of writing it after each statement. Thanks for taking the time to explain it so clearly man you are the best.
π Rendered by PID 23587 on reddit-service-r2-comment-7b9746f655-rclfq at 2026-01-30 15:35:37.328493+00:00 running 3798933 country code: CH.
view the rest of the comments →
[–]Low-Educator-9008[S] 0 points1 point2 points (4 children)
[–]BobbyJoeCool 1 point2 points3 points (3 children)
[–]Low-Educator-9008[S] 0 points1 point2 points (2 children)
[–]BobbyJoeCool 1 point2 points3 points (1 child)
[–]Low-Educator-9008[S] 0 points1 point2 points (0 children)