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