Last active
February 7, 2017 11:47
-
-
Save Crowbrammer/e81db8b62ff520a37f7cb2dd409a1da0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try: | |
APY = float(input('GIVE ME YOUR APY: ')) | |
except ValueError: | |
def apy_except_handler(): | |
try: | |
APY = float(input('Please enter a number for your APY')) | |
except ValueError: | |
apy_except_handler() | |
return APY | |
APY = apy_except_handler() | |
print('Pre-percentified APY: ' + str(APY)) | |
''' | |
Why does this happen, and what do I do to store the number into APY? | |
To create an UnboundLocalError: | |
1. Enter letters when it asks for your APY x 2+ times | |
2. Enter a number | |
Notes: | |
- If I put return APY, it gives me a 'None' value. | |
- If I put it after the try-except clause, it'll give the UnboundLocalError | |
''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment