LU05.L02: Exception fangen und verarbeiten

catch_exception.py
"""
A simple program to demonstrate except
"""
from namelist import NameList
 
 
def main():
    """ main function for running the code """
    name_list = NameList()
    try:
        for idx in range(6):
            print(name_list.take_name(idx))
    except IndexError as idx_error:
        print(idx_error)
 
 
if __name__ == '__main__':
    main()

René Probst, bearbeitet durch Marcel Suter

  • modul/m320_2024/learningunits/lu05/loesungen/fangen.txt
  • Zuletzt geändert: 2024/08/26 13:40
  • von msuter