From 43de8dc79c163195299a812a788c9cfb7e3e39b1 Mon Sep 17 00:00:00 2001 From: baphim <269010393+baphim@users.noreply.github.com> Date: Sat, 12 Sep 2026 20:06:47 -0400 Subject: [PATCH] feat: created lab-02 dir and problem-01 file --- lab-02/problem-01.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 lab-02/problem-01.py diff --git a/lab-02/problem-01.py b/lab-02/problem-01.py new file mode 100644 index 0000000..43e5c99 --- /dev/null +++ b/lab-02/problem-01.py @@ -0,0 +1,12 @@ +# Write a Python program to handle a ZeroDivisionError exception when dividing a number by zero + + +def divide(x, y) + try: + # try to divide the provided values and store in variable: answer + answer = x / y + print(answer) + except ZeroDivisionError: + print("Enter a non-zero value") + +divide(6, 2) \ No newline at end of file