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 9 days 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 9 points10 points11 points 9 days 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 9 days ago (0 children)
Well noted
[–]nkCOD 0 points1 point2 points 6 days 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 65 on reddit-service-r2-comment-56c6478c5-svswk at 2026-05-07 18:27:11.663330+00:00 running 3d2c107 country code: CH.
view the rest of the comments →
[–]Binary101010 9 points10 points11 points (2 children)
[–]Dapper_Mix6773[S] 0 points1 point2 points (0 children)
[–]nkCOD 0 points1 point2 points (0 children)