From 0168228f7fb35e4bb6bfd36e7561138035f8e080 Mon Sep 17 00:00:00 2001 From: baphim <269010393+baphim@users.noreply.github.com> Date: Mon, 14 Sep 2026 16:29:58 -0400 Subject: [PATCH] feat: completed problem-10.py --- lab-02/problem-01.py | 2 +- lab-02/problem-10.py | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lab-02/problem-01.py b/lab-02/problem-01.py index 9494092..14f9af5 100644 --- a/lab-02/problem-01.py +++ b/lab-02/problem-01.py @@ -15,5 +15,5 @@ dividend = 93 # and a value to divide by divisor = 0 - +#Call the function with defined vars divide(dividend, divisor) \ No newline at end of file diff --git a/lab-02/problem-10.py b/lab-02/problem-10.py index c9a27fb..00b7d05 100644 --- a/lab-02/problem-10.py +++ b/lab-02/problem-10.py @@ -1,2 +1,12 @@ # Write a Python program that executes a list operation and handles an AttributeError exception if the attribute does -# not exist. \ No newline at end of file +# not exist. + +# Define a list and set it to 'demo_list' var +demo_list = ['a', 'b', 'c', 'd'] +# Try a non-existent method on the list var (madeupmethod) +try: + demo_list.madeupmethod() +# Handle the expected AttributeError +except AttributeError: + # Print error message + print('That method is not valid') \ No newline at end of file