Last active
October 20, 2016 21:28
-
-
Save pszpetkowski/24e067a19359a33d1028b176be4cfe76 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #!/usr/bin/env python | |
| def recursive_arithmetic_exception(depth=0, max_depth=20): | |
| raise_string = ( | |
| '%stry:\n' | |
| '%sraise ArithmeticError\n' | |
| '%sexcept ArithmeticError:\n' | |
| % (' ' * depth * 4, ' ' * (depth * 4 + 4), ' ' * depth * 4)) | |
| if depth < max_depth: | |
| raise_string += recursive_arithmetic_exception(depth=depth+1, max_depth=max_depth) | |
| if depth == 0: | |
| raise_string += '%sraise ZeroDivisionError\n' % (' ' * (max_depth * 4 + 4)) | |
| return raise_string |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment