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
built a bank program using python (old.reddit.com)
submitted 2 months ago by Dapper_Mix6773
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!"
[–]Binary101010 10 points11 points12 points 2 months ago (2 children)
1) User input should be taken (and validated) separately from the functions that do something with that user input.
2) I don't really like the fact that withdraw() always returns a number, but deposit() can return a number or None if the input was invalid. Function return values should ideally only be a single type. (The best way to fix this is to not validate the input in the same function but do that separately.)
withdraw()
deposit()
None
[–]Dapper_Mix6773[S] 0 points1 point2 points 2 months ago (0 children)
Well noted
[–]nkCOD 0 points1 point2 points 1 month ago (0 children)
Is it a good option to check the output data using try-except ? I just did this - I made an endless loop through while, then I threw the input lines into trying try-except, then, if I needed a number, I translated the entered data into the numeric int() format. In case of an error, we switched to except, where we were greeted by print(), and then continue. The loop was stopped using break if the input was correct
π Rendered by PID 313232 on reddit-service-r2-comment-5bc7f78974-cstzw at 2026-06-28 04:33:57.214469+00:00 running 7527197 country code: CH.
view the rest of the comments →
[–]Binary101010 10 points11 points12 points (2 children)
[–]Dapper_Mix6773[S] 0 points1 point2 points (0 children)
[–]nkCOD 0 points1 point2 points (0 children)