feat: completed problem-10.py

This commit is contained in:
baphim
2026-09-14 16:29:58 -04:00
parent 968ce1621d
commit 0168228f7f
2 changed files with 12 additions and 2 deletions
+1 -1
View File
@@ -15,5 +15,5 @@ dividend = 93
# and a value to divide by # and a value to divide by
divisor = 0 divisor = 0
#Call the function with defined vars
divide(dividend, divisor) divide(dividend, divisor)
+11 -1
View File
@@ -1,2 +1,12 @@
# Write a Python program that executes a list operation and handles an AttributeError exception if the attribute does # Write a Python program that executes a list operation and handles an AttributeError exception if the attribute does
# not exist. # 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')