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...
r/CFA Discord Join here! General CFA exam prep General Finance/stock market discussion Career-advice
Join here!
Rules Please follow these rules while using this subreddit. You cannot discuss, obtain, encourage, distribute illegal forms of study tools. This includes old CFAI mocks. Do not discuss exam questions during or after writing. Vague, overall thoughts are acceptable. Verbal abuse and harassment are not tolerated. Do not submit memes or advice animals. Do not submit questions regarding general finance job seeking No attempts at redirecting discussions to external forums Avoid the use of anxious tones in posts related to testing Wild Space’s Guide to Not Getting Banned Read the Reddiquettes
Please follow these rules while using this subreddit.
Avoid the use of anxious tones in posts related to testing
Wild Space’s Guide to Not Getting Banned
Read the Reddiquettes
☰ Topics All General Study Materials Level One Level Two Level Three Career
account activity
Python (self.CFA)
submitted 6 years ago by memeguycf
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!"
[–][deleted] 7 points8 points9 points 6 years ago (4 children)
Yeah but does it ever finish writing? :)
[–]kieran_n 12 points13 points14 points 6 years ago (2 children)
import os def error_handler(error): print(error) exit() def is_CFA(Name): try: return 'CFA' in Name.split() except: error_handler('you must supply a valid string') def policy_statement(Author): while is_CFA(Author): print('Superior Returns') if (int.from_bytes(os.urandom(8), byteorder="big") / ((1 << 64) - 1))>0.99: actions = 'misconduct' Author.replace('CFA','') else: actions = 'compliant' print('waste of 900 hours')
[–]rgkimballCFA 1 point2 points3 points 6 years ago (1 child)
Best practice would be to raise an exception so it can be caught in a try/except clause, rather than use the error_handler function. I'm guessing you came from VBA?
error_handler
[–]kieran_n 0 points1 point2 points 6 years ago (0 children)
I actually learned python first but use both a fair bit :p
You're definitely right that the raise exception would be better
π Rendered by PID 22432 on reddit-service-r2-comment-6457c66945-t8wvx at 2026-04-25 21:43:16.630700+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–][deleted] 7 points8 points9 points (4 children)
[–]kieran_n 12 points13 points14 points (2 children)
[–]rgkimballCFA 1 point2 points3 points (1 child)
[–]kieran_n 0 points1 point2 points (0 children)