From 5c13e24abf400e96fe42b0d06f043e998e324227 Mon Sep 17 00:00:00 2001 From: marcv Date: Thu, 8 Oct 2026 10:14:27 +0200 Subject: [PATCH] Add error-handling.py --- error_handling.py | 10 ++++++++++ test.py | 0 2 files changed, 10 insertions(+) create mode 100644 error_handling.py delete mode 100644 test.py diff --git a/error_handling.py b/error_handling.py new file mode 100644 index 0000000..e5415bc --- /dev/null +++ b/error_handling.py @@ -0,0 +1,10 @@ +def spam(divide_by): + try: + return 42 / divide_by + except ZeroDivisionError: + print('Error: Invalid argument.') + +print(spam(2)) +print(spam(1)) +print(spam(42)) +print(spam(0)) \ No newline at end of file diff --git a/test.py b/test.py deleted file mode 100644 index e69de29..0000000