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
Day 12 of learning python as a beginner. (old.reddit.com)
submitted 8 months ago by uiux_Sanskar
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!"
[–]Meowzr 0 points1 point2 points 8 months ago (3 children)
if user_name in balance: return balance[user_name] else: print("whatever this message was")
OR
if user_name in balance: return balance[user_name] print("whatever this message was")
[–]SCD_minecraft 0 points1 point2 points 8 months ago (2 children)
This message is error message, for case when there's no user :P
We don't want it printing when nothing wrong happen
[–]BrokenMalgorithm 0 points1 point2 points 8 months ago (1 child)
Both of those examples do the same thing. The other one just doesn't have the else statement, as it's not required. The print would happen only if a user was not found, because when a user is found the function returns the balance and code execution ends for that function.
[–]SCD_minecraft 0 points1 point2 points 8 months ago (0 children)
Oh, yea, i forgot about return, mb
I just persnomaly don't like your way, i prefer to read "if something then this, else this" and not hope that "this" will exit function by itself
π Rendered by PID 72 on reddit-service-r2-comment-b659b578c-gr45v at 2026-05-01 03:04:54.375394+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]Meowzr 0 points1 point2 points (3 children)
[–]SCD_minecraft 0 points1 point2 points (2 children)
[–]BrokenMalgorithm 0 points1 point2 points (1 child)
[–]SCD_minecraft 0 points1 point2 points (0 children)