Files
2026-09-14 16:30:33 -04:00

12 lines
427 B
Python

# Write a Python program that executes a list operation and handles an AttributeError exception if the attribute does
# 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')