Example #1
0
def main():
    init_pupils_data()
    teachers = Teachers()

    while True:
        print("\n==============")
        print("      MENU      ")
        print("1 - Create Pupil")
        print("2 - Print")
        print("3 - Update Pupil")
        print("4 - Delete Pupil")
        print("5 - Create Teacher")
        print("6 - Read Teacher")
        print("7 - Update Teacher")
        print("8 - Delete Teacher")
        print("9 - Exit")
        choice = int(input("Pick one: "))

        if choice == 1:
            print("NEW PUPIL")
            print("=========")
            pupil = create_pupil()
            if pupil is None:
                continue
            else:
                print("NEW PUPIL")
                print_pupil(pupil)

        elif choice == 2:
            print("\n==============")
            print("    SUB MENU     ")
            print("1 - Print Pupil")
            print("2 - Print All Pupils (details)")
            print("3 - Print All Pupils (names)")
            print_choice = input("Pick one: ")
            if print_choice.strip().isdigit():
                print_choice = int(print_choice)
            else:
                print("Wrong input")
                continue

            if print_choice == 1:
                pupil_id = int(input("Type the pupil's id: "))
                pupil = search_pupil_by_id(pupil_id)
                if pupil is None:
                    print("Pupil does not exist with this id")
                else:
                    print("     PUPIL      ")
                    print_pupil(pupil)
            elif print_choice == 2:
                print_pupils_details()
            elif print_choice == 3:
                print_pupils_names()
            else:
                print("Wrong input")
                continue

        elif choice == 3:
            print("\n==============")
            print("      SUB-MENU (UPDATE)      ")
            print("1 - Update Pupil (search by id)")
            print("2 - Update Pupil (search by surname)")
            update_choice = input("Pick one: ")
            if update_choice.strip().isdigit():
                update_choice = int(update_choice)
            else:
                print("Wrong input")
                continue

            if update_choice == 1:
                pupil_id = int(input("Type an id: "))
                pupil = search_pupil_by_id(pupil_id)
                if pupil is None:
                    print("Error, there is no pupil with that id")
                    continue
            elif update_choice == 2:
                pupil_surname = input("Type the students surname: ")
                matching_pupils = search_pupil_by_surname(pupil_surname)
                if matching_pupils == []:
                    print("No match found")
                    continue
                if len(matching_pupils) == 1:
                    pupil = matching_pupils[0]
                else:
                    for p in matching_pupils:
                        print_pupil(p)
                        print(f"id = {p['id']}")
                        print("=" * 15)
                    pupil_id = int(input("type an id: "))
                    pupil = search_pupil_by_id(pupil_id)

            # pupil update

            pupil_update(pupil)

        elif choice == 4:
            print("\n==============")
            print("      SUB-MENU (DELETE)      ")
            print("1 - Delete Pupil (search by id)")
            print("2 - Delete Pupil (search by surname)")
            delete_choice = input("Pick one: ")
            if delete_choice.strip().isdigit():
                delete_choice = int(delete_choice)
            else:
                print("Wrong input")
                continue

            if delete_choice == 1:
                pupil_id = int(input("Type an id: "))
                pupil = search_pupil_by_id(pupil_id)
                if pupil is None:
                    print("Error, there is no pupil with that id")
                    continue
            elif delete_choice == 2:
                pupil_surname = input("Type the students surname: ")
                matching_pupils = search_pupil_by_surname(pupil_surname)
                if matching_pupils == []:
                    print("No match found")
                    continue
                if len(matching_pupils) == 1:
                    pupil = matching_pupils[0]
                else:
                    for p in matching_pupils:
                        print_pupil(p)
                        print(f"id = {p['id']}")
                        print("=" * 15)
                    pupil_id = int(input("type an id: "))
                    pupil = search_pupil_by_id(pupil_id)
            # Delete pupil
            delete_pupil_by_id(pupil["id"])
        elif choice == 5:
            first_name = input("Type teachers name: ")
            surname = input("Type teachers surname: ")
            teachers.create_teacher(first_name, surname)
        elif choice == 6:
            teacher_id = int(input("type the teacher's id: "))
            teacher = teachers.read_teacher(teacher_id)
            if teacher is None:
                print("No such teacher exists")
            else:
                teacher.print_teacher()
        elif choice == 7:
            teacher_id = int(input("type the teacher's id: "))
            teachers.update_teacher(teacher_id)
        elif choice == 8:
            teacher_id = int(input("type the teacher's id: "))
            teachers.delete_teacher(teacher_id)
        elif choice == 9:
            print("Bye")
            teachers.save_teachers_data()
            save_pupils_data()
            break
Example #2
0
def main():

    init_pupils_data()
    teachers = Teachers()

    while True:
        print("\n===============")
        print("     MENU ")
        print("1 - Create Pupil")
        print("2 - Print")
        print("3 - Update Pupil")
        print("4 - Delete Pupil")
        print("5 - Create Teacher")
        print("6 - Read Teacher")
        print("7 - Update Teacher")
        print("8 - Delete Teacher")
        print("9 - Exit")
        choice = int(input("Pick one: "))

        if choice == 1:
            print("NEW PUPIL")
            print("===========")
            pupil = create_pupil()
            if pupil is None:
                continue
            else:
                print("NEW PUPIL")
                print_pupil(pupil)

        elif choice == 2:
            print("\n===============")
            print("     SUB-MENU (PRINT) ")
            print("1 - Print Pupil")
            print("2 - Print all pupils (details)")
            print("3 - Print all pupils (just the names)")
            print_choice = input("Give your choice: ")
            if print_choice.strip().isdigit():
                print_choice = int(print_choice)
            else:
                print("Wrong input!")
                continue

            if print_choice == 1:
                pupil_id = int(input("Give id: "))
                pupil = search_pupil_by_id(pupil_id)
                if pupil is None:
                    print("Pupil does not exist (with this id)")
                else:
                    print("   PUPIL   ")
                    print_pupil(pupil)

            elif print_choice == 2:
                print_pupils_details()
            elif print_choice == 3:
                print_pupils_names()
            else:
                print("Wrong input! ")
                continue

        elif choice == 3:
            print("\n===============")
            print("     SUB-MENU (UPDATE) ")
            print("1 - Update Pupil (search by id)")
            print("2 - Update Pupil (search by surname)")
            update_choice = input("Give your choice: ")
            if update_choice.strip().isdigit():
                update_choice = int(update_choice)
            else:
                print("Wrong input!")
                continue

            if update_choice == 1:
                pupil_id = int(input("Give id: "))
                pupil = search_pupil_by_id(pupil_id)
                if pupil is None:
                    print("Error! There is no pupil with this id!")
                    continue
            elif update_choice == 2:
                surname = input("Give surname: ")
                matching_pupils = search_pupil_by_surname(surname)
                if not matching_pupils:
                    print("No matching pupils with this surname!")
                    continue
                elif len(matching_pupils) == 1:
                    pupil = matching_pupils[0]
                else:
                    for p in matching_pupils:
                        print_pupil(p)
                        print(f"id = {p['id']}")
                        print("-" * 15)
                    pupil_id = int(input("Give id: "))
                    pupil = search_pupil_by_id(pupil_id)

            # pupil: update
            pupil_update(pupil)

        elif choice == 4:
            print("\n===============")
            print("     SUB-MENU (DELETE) ")
            print("1 - Delete Pupil (search by id)")
            print("2 - Delete Pupil (search by surname)")
            delete_choice = input("Give your choice: ")
            if delete_choice.strip().isdigit():
                delete_choice = int(delete_choice)
            else:
                print("Wrong input!")
                continue

            if delete_choice == 1:
                pupil_id = int(input("Give id: "))
                pupil = search_pupil_by_id(pupil_id)
                if pupil is None:
                    print("Error! There is no pupil with this id!")
                    continue
            elif delete_choice == 2:
                surname = input("Give surname: ")
                matching_pupils = search_pupil_by_surname(surname)
                if not matching_pupils:
                    print("No matching pupils with this surname!")
                    continue
                elif len(matching_pupils) == 1:
                    pupil = matching_pupils[0]
                else:
                    for p in matching_pupils:
                        print_pupil(p)
                        print(f"id = {p['id']}")
                        print("-" * 15)
                    pupil_id = int(input("Give id: "))
                    pupil = search_pupil_by_id(pupil_id)

            # pupil: delete
            delete_pupil_by_id(pupil["id"])
        elif choice == 5:
            first_name = input("Give name: ")
            surname = input("Give surname: ")
            teachers.create_teacher(first_name, surname)
        elif choice == 6:
            teacher_id = int(input("Give id: "))
            teacher = teachers.read_teacher(teacher_id)
            if teacher is None:
                print("No such teacher exists!")
            else:
                teacher.print_teacher()
        elif choice == 7:
            teacher_id = int(input("Give id: "))
            teachers.update_teacher(teacher_id)
        elif choice == 8:
            teacher_id = int(input("Give id: "))
            teachers.delete_teacher(teacher_id)
        elif choice == 9:
            print("Bye bye!")
            teachers.save_teachers_data()
            save_pupils_data()
            break
Example #3
0
def main():

    pupils = Pupils()
    teachers = Teachers()
    lessons = Lessons()

    while True:

        menu()

        choice = get_int("Pick one: ")

        if choice == 1:

            pupils_menu()

            pupils_choice = get_int("Pick one: ")

            if pupils_choice == 1:
                print("NEW PUPIL")
                print("===========")
                pupil = pupils.create_pupil()
                if pupil is None:
                    continue
                else:
                    print("NEW PUPIL")
                    print(pupil)

            elif pupils_choice == 2:

                pupils_print_submenu()

                print_choice = get_int("Give your choice: ")

                if print_choice == 1:
                    pupil_id = get_int("Give id: ")
                    pupil = pupils.search_pupil_by_id(pupil_id)
                    if pupil is None:
                        print("Pupil does not exist (with this id)")
                    else:
                        print("   PUPIL   ")
                        print(pupil)
                elif print_choice == 2:
                    print(pupils)
                elif print_choice == 3:
                    pupils.print_pupils_names()
                else:
                    print("Wrong input! ")
                    continue

            elif pupils_choice == 3:

                pupils_update_submenu()

                update_choice = get_int("Give your choice: ")
                if update_choice == 1:
                    pupil_id = get_int("Give id: ")
                    pupil = pupils.search_pupil_by_id(pupil_id)
                    if pupil is None:
                        print("Error! There is no pupil with this id!")
                        continue
                elif update_choice == 2:
                    surname = input("Give surname: ")
                    matching_pupils = pupils.search_pupil_by_surname(surname)
                    if not matching_pupils:
                        print("No matching pupils with this surname!")
                        continue
                    elif len(matching_pupils) == 1:
                        pupil = matching_pupils[0]
                    else:
                        for p in matching_pupils:
                            print(p)
                            print(f"id = {p['id']}")
                            print("-" * 15)
                        pupil_id = get_int("Give id: ")
                        pupil = pupils.search_pupil_by_id(pupil_id)

                # pupil: update
                pupils.pupil_update(pupil)

            elif pupils_choice == 4:

                pupils_delete_submenu()

                delete_choice = get_int("Give your choice: ")

                if delete_choice == 1:
                    pupil_id = get_int("Give id: ")

                    pupil = pupils.search_pupil_by_id(pupil_id)
                    if pupil is None:
                        print("Error! No pupil with this id!")
                        continue

                elif delete_choice == 2:
                    last_name = input("Give surname: ")
                    matching_pupils = pupils.search_pupil_by_surname(last_name)
                    if not matching_pupils:
                        print("No matching pupils with this surname!")
                        continue
                    elif len(matching_pupils) == 1:
                        pupil = matching_pupils[0]
                    else:
                        for p in matching_pupils:
                            print(p)
                            print(f"id = {p['id']}")
                            print("-" * 15)
                        pupil_id = get_int("Give id: ")
                        pupil = pupils.search_pupil_by_id(pupil_id)

                pupils.delete_pupil_by_id(pupil_id, lessons)

        elif choice == 2:

            teachers_menu()

            teacher_choice = get_int("Pick one: ")

            if teacher_choice == 1:
                first_name = input("Give name: ")
                last_name = input("Give surname: ")
                teachers.create_teacher(first_name, last_name)
            elif teacher_choice == 2:
                teacher_id = get_int("Give id: ")
                teacher = teachers.read_teacher(teacher_id)
                if teacher is None:
                    print("No such teacher exists!")
                else:
                    print(teacher)
            elif teacher_choice == 3:
                teacher_id = get_int("Give id: ")
                teachers.update_teacher(teacher_id)
            elif teacher_choice == 4:
                teacher_id = get_int("Give id: ")
                teachers.delete_teacher(teacher_id, lessons)

        elif choice == 3:

            lessons_menu()

            lesson_choice = get_int("Pick one: ")

            if lesson_choice == 1:
                lesson_name = input("Give lesson name: ")
                lessons.create_lesson(lesson_name)
            elif lesson_choice == 2:
                lesson_id = get_int("Give id: ")
                lesson = lessons.read_lesson(lesson_id)
                if lesson is None:
                    print("No such lesson exists!")
                else:
                    lesson.print_lesson_details(teachers, pupils)
            elif lesson_choice == 3:
                lesson_id = get_int("Give id: ")
                lessons.update_lesson(lesson_id, teachers, pupils)
            elif lesson_choice == 4:
                lesson_id = get_int("Give id: ")
                lessons.delete_lesson(lesson_id)

        elif choice == 4:
            print("Bye bye!")
            pupils.save_pupils_data()
            teachers.save_teachers_data()
            lessons.save_lessons_data()
            break
Example #4
0
def main():

    pupils = Pupils()
    teachers = Teachers()
    lessons = Lessons()

    while True:
        print("\n===============")
        print("     MENU ")

        print("1 - Manage Pupils")
        print("2 - Manage Teachers")
        print("3 - Manage Lessons")
        print("4 - Exit")
        choice = int(input("Pick one: "))

        if choice == 1:
            print("\n===============")
            print(" PUPILS MENU ")

            print("1 - Create Pupil")
            print("2 - Print Pupil(s)")
            print("3 - Update Pupil")
            print("4 - Delete Pupil")
            pupils_choice = int(input("Pick one: "))

            if pupils_choice == 1:
                print("NEW PUPIL")
                print("===========")
                pupil = pupils.create_pupil()
                if pupil is None:
                    continue
                else:
                    print("NEW PUPIL")
                    print(pupil)

            elif pupils_choice == 2:
                print("\n===============")
                print("     SUB-MENU (PRINT) ")
                print("1 - Print Pupil")
                print("2 - Print all pupils (details)")
                print("3 - Print all pupils (just the names)")
                print_choice = input("Give your choice: ")
                if print_choice.strip().isdigit():
                    print_choice = int(print_choice)
                else:
                    print("Wrong input!")
                    continue

                if print_choice == 1:
                    pupil_id = int(input("Give id: "))
                    pupil = pupils.search_pupil_by_id(pupil_id)
                    if pupil is None:
                        print("Pupil does not exist (with this id)")
                    else:
                        print("   PUPIL   ")
                        print(pupil)

                elif print_choice == 2:
                    print(pupils)
                elif print_choice == 3:
                    pupils.print_pupils_names()
                else:
                    print("Wrong input! ")
                    continue

            elif pupils_choice == 3:
                print("\n===============")
                print("     SUB-MENU (UPDATE) ")
                print("1 - Update Pupil (search by id)")
                print("2 - Update Pupil (search by surname)")
                update_choice = input("Give your choice: ")
                if update_choice.strip().isdigit():
                    update_choice = int(update_choice)
                else:
                    print("Wrong input!")
                    continue

                if update_choice == 1:
                    pupil_id = int(input("Give id: "))
                    pupil = pupils.search_pupil_by_id(pupil_id)
                    if pupil is None:
                        print("Error! There is no pupil with this id!")
                        continue
                elif update_choice == 2:
                    surname = input("Give surname: ")
                    matching_pupils = pupils.search_pupil_by_surname(surname)
                    if not matching_pupils:
                        print("No matching pupils with this surname!")
                        continue
                    elif len(matching_pupils) == 1:
                        pupil = matching_pupils[0]
                    else:
                        for p in matching_pupils:
                            print(p)
                            print(f"id = {p['id']}")
                            print("-" * 15)
                        pupil_id = int(input("Give id: "))
                        pupil = pupils.search_pupil_by_id(pupil_id)

                # pupil: update
                pupils.pupil_update(pupil)

            elif pupils_choice == 4:
                print("\n===============")
                print("     SUB-MENU (DELETE) ")
                print("1 - Delete Pupil (search by id)")
                print("2 - Delete Pupil (search by surname)")
                delete_choice = input("Give your choice: ")
                if delete_choice.strip().isdigit():
                    delete_choice = int(delete_choice)
                else:
                    print("Wrong input!")
                    continue

                if delete_choice == 1:
                    pupil_id = int(input("Give id: "))
                    pupil = pupils.search_pupil_by_id(pupil_id)
                    if pupil is None:
                        print("Error! There is no pupil with this id!")
                        continue
                elif delete_choice == 2:
                    surname = input("Give surname: ")
                    matching_pupils = pupils.search_pupil_by_surname(surname)
                    if not matching_pupils:
                        print("No matching pupils with this surname!")
                        continue
                    elif len(matching_pupils) == 1:
                        pupil = matching_pupils[0]
                    else:
                        for p in matching_pupils:
                            print(p)
                            print(f"id = {p['id']}")
                            print("-" * 15)
                        pupil_id = int(input("Give id: "))
                        pupil = pupils.search_pupil_by_id(pupil_id)

                # pupil: delete
                pupils.delete_pupil_by_id(pupil.pupil_id, lessons)

        elif choice == 2:
            print("\n===============")
            print(" TEACHERS MENU ")

            print("1 - Create Teacher")
            print("2 - Print Teacher(s)")
            print("3 - Update Teacher")
            print("4 - Delete Teacher")
            teacher_choice = int(input("Pick one: "))

            if teacher_choice == 1:
                first_name = input("Give name: ")
                surname = input("Give surname: ")
                teachers.create_teacher(first_name, surname)
            elif teacher_choice == 2:
                teacher_id = int(input("Give id: "))
                teacher = teachers.read_teacher(teacher_id)
                if teacher is None:
                    print("No such teacher exists!")
                else:
                    print(teacher)
            elif teacher_choice == 3:
                teacher_id = int(input("Give id: "))
                teachers.update_teacher(teacher_id)
            elif teacher_choice == 4:
                teacher_id = int(input("Give id: "))
                teachers.delete_teacher(teacher_id, lessons)

        elif choice == 3:
            print("\n===============")
            print(" LESSONS MENU ")

            print("1 - Create Lesson")
            print("2 - Print Lesson")
            print("3 - Update Lesson")
            print("4 - Delete Lesson")
            lesson_choice = int(input("Pick one: "))

            if lesson_choice == 1:
                lesson_name = input("Give lesson name: ")
                lessons.create_lesson(lesson_name)
            elif lesson_choice == 2:
                lesson_id = int(input("Give id: "))
                lesson = lessons.read_lesson(lesson_id)
                if lesson is None:
                    print("No such lesson exists!")
                else:
                    lesson.print_lesson_details(teachers, pupils)
            elif lesson_choice == 3:
                lesson_id = int(input("Give id: "))
                lessons.update_lesson(lesson_id, teachers, pupils)
            elif lesson_choice == 4:
                lesson_id = int(input("Give id: "))
                lessons.delete_lesson(lesson_id)

        elif choice == 4:
            print("Bye bye!")
            pupils.save_pupils_data()
            teachers.save_teachers_data()
            lessons.save_lessons_data()
            break
Example #5
0
def main():
    pupils = Pupils()
    teachers = Teachers()
    lessons = Lessons()

    while True:
        print("\n==============")
        print("      MENU      ")
        print("1 - Manage Pupils")
        print("2 - Manage Teachers")
        print("3 - Manage Lessons")
        print("4 - Exit")
        choice = int(input("Pick a number: "))
        if choice == 1:
            print("\n==============")
            print(" PUPILS MENU ")
            print("1 - Create Pupil")
            print("2 - Print Pupil(s)")
            print("3 - Update Pupil")
            print("4 - Delete Pupil")
            choice = int(input("Pick one: "))

            if choice == 1:
                print("NEW PUPIL")
                print("=========")
                pupil = pupils.create_pupil()
                if pupil is None:
                    continue
                else:
                    print("NEW PUPIL")
                    print(pupil)

            elif choice == 2:
                print("\n==============")
                print("    SUB MENU     ")
                print("1 - Print Pupil")
                print("2 - Print All Pupils (details)")
                print("3 - Print All Pupils (names)")
                print_choice = input("Pick one: ")
                if print_choice.strip().isdigit():
                    print_choice = int(print_choice)
                else:
                    print("Wrong input")
                    continue

                if print_choice == 1:
                    pupil_id = int(input("Type the pupil's id: "))
                    pupil = pupils.search_pupil_by_id(pupil_id)
                    if pupil is None:
                        print("Pupil does not exist with this id")
                    else:
                        print("     PUPIL      ")
                        print(pupil)
                elif print_choice == 2:
                    print(pupils)
                elif print_choice == 3:
                    pupils.print_pupils_names()
                else:
                    print("Wrong input")
                    continue

            elif choice == 3:
                print("\n==============")
                print("      SUB-MENU (UPDATE)      ")
                print("1 - Update Pupil (search by id)")
                print("2 - Update Pupil (search by surname)")
                update_choice = input("Pick one: ")
                if update_choice.strip().isdigit():
                    update_choice = int(update_choice)
                else:
                    print("Wrong input")
                    continue

                if update_choice == 1:
                    pupil_id = int(input("Type an id: "))
                    pupil = pupils.search_pupil_by_id(pupil_id)
                    if pupil is None:
                        print("Error, there is no pupil with that id")
                        continue
                elif update_choice == 2:
                    pupil_surname = input("Type the students surname: ")
                    matching_pupils = pupils.search_pupil_by_surname(
                        pupil_surname)
                    if not matching_pupils:
                        print("No match found")
                        continue
                    if len(matching_pupils) == 1:
                        pupil = matching_pupils[0]
                    else:
                        for p in matching_pupils:
                            print(p)
                            print(f"id = {p['id']}")
                            print("=" * 15)
                        pupil_id = int(input("type an id: "))
                        pupil = pupils.search_pupil_by_id(pupil_id)

                # pupil update

                pupils.pupil_update(pupil)

            elif choice == 4:
                print("\n==============")
                print("      SUB-MENU (DELETE)      ")
                print("1 - Delete Pupil (search by id)")
                print("2 - Delete Pupil (search by surname)")
                delete_choice = input("Pick one: ")
                if delete_choice.strip().isdigit():
                    delete_choice = int(delete_choice)
                else:
                    print("Wrong input")
                    continue

                if delete_choice == 1:
                    pupil_id = int(input("Type an id: "))
                    pupil = pupils.search_pupil_by_id(pupil_id)
                    if pupil is None:
                        print("Error, there is no pupil with that id")
                        continue
                elif delete_choice == 2:
                    pupil_surname = input("Type the students surname: ")
                    matching_pupils = pupils.search_pupil_by_surname(
                        pupil_surname)
                    if not matching_pupils:
                        print("No match found")
                        continue
                    if len(matching_pupils) == 1:
                        pupil = matching_pupils[0]
                    else:
                        for p in matching_pupils:
                            print(p)
                            print(f"id = {p['id']}")
                            print("=" * 15)
                        pupil_id = int(input("type an id: "))
                        pupil = pupils.search_pupil_by_id(pupil_id)
                # Delete pupil
                pupils.delete_pupil_by_id(pupil.pupil_id, lessons)
        elif choice == 2:
            print(" TEACHER MENU ")
            print("1 - Create Teacher")
            print("2 - Print Teacher")
            print("3 - Update Teacher")
            print("4 - Delete Teacher")
            choice = int(input("Pick one: "))
            if choice == 1:
                first_name = input("Type teachers name: ")
                surname = input("Type teachers surname: ")
                teachers.create_teacher(first_name, surname)
            elif choice == 2:
                teacher_id = int(input("type the teacher's id: "))
                teacher = teachers.read_teacher(teacher_id)
                if teacher is None:
                    print("No such teacher exists")
                else:
                    teacher.print_teacher()
            elif choice == 3:
                teacher_id = int(input("type the teacher's id: "))
                teachers.update_teacher(teacher_id)
            elif choice == 4:
                teacher_id = int(input("type the teacher's id: "))
                teachers.delete_teacher(teacher_id, lessons)
        elif choice == 3:
            print(" LESSONS MENU ")
            print("1 - Create Lesson")
            print("2 - Print Lesson")
            print("3 - Update Lesson")
            print("4 - Delete Lesson")
            choice = int(input("Pick one: "))
            if choice == 1:
                lesson_name = input("Type lesson's name: ")
                lessons.create_lesson(lesson_name)
            elif choice == 2:
                lesson_id = int(input("type the lesson's id: "))
                lesson = lessons.read_lesson(lesson_id)
                if lesson is None:
                    print("No such lesson exists")
                else:
                    lesson.print_lesson_details(teachers, pupils)
            elif choice == 3:
                lesson_id = int(input("Type lesson's id: "))
                lessons.update_lesson(lesson_id, teachers, pupils)
            elif choice == 4:
                lesson_id = int(input("Type lesson's id: "))
                lessons.delete_lesson(lesson_id)
        elif choice == 4:
            print("Bye")
            teachers.save_teachers_data()
            pupils.save_pupils_data()
            lessons.save_lessons_data()
            break