def main(): login() # Main menu while user != 3: print("1: Record Attendance") print("2: Generate Statistics") print("3: Exit") choice = reading_from_user.read_range_integer("> ", min_range=1, max_range=3) if choice == 1: modules_name, modules_codes = modules() selection = module_selection(modules_name, modules_codes) name, present, absent, excused = class_attendance(selection) modify_class_attendance(name, present, absent, excused) update_attendance(name, present, absent, excused, selection) elif choice == 2: modules_name, modules_codes = modules() selection = module_selection(modules_name, modules_codes) name, present, absent, excused = class_attendance(selection) students, total_class, average_attendance, low_attender, highest_attender_name, selection, non_attender\ = statistics(selection, name) file_stats(selection, students, total_class, average_attendance, low_attender, highest_attender_name, non_attender) elif choice == 3: exit()
def module_selection(module_names, module_codes): print(f"Please select a module:") for i, module in enumerate(module_names): print(f"{i+1}. {module_codes[i]}") selection = reading_from_user.read_range_integer("> ", min_range=1, max_range=2) selection = module_codes[selection - 1] return selection
def modify_class_attendance(name, present, absent, excused): students = len(name) print(f"There are {students} students registered in this class") for i, students in enumerate(name): print(f"Student #{i + 1}: {name[i]}") print(f"1. Present \n2. Absent \n3. Excused") choice = reading_from_user.read_range_integer("> ", min_range=1, max_range=3) if choice == 1: present[i] = present[i] + 1 elif choice == 2: absent[i] = absent[i] + 1 elif choice == 3: excused[i] = excused[i] + 1 return name, present, absent, excused
def main(): while True: menu_choice = menu() if menu_choice == 1: print( "Module Record System(Attendance) - Choose A Module\n-----------------------------------------------------" ) modules_names_list, module_codes_list = load_modules() for number, names in enumerate(modules_names_list): print(number + 1, names, "----", module_codes_list[number]) module_pick = reading_from_user.read_range_integer(">", 1, 2) module_pick = modules_names_list[module_pick - 1] names_list, present_list, absent_list, excused_list = get_class_attendance( module_pick) print(names_list, present_list, absent_list, excused_list) elif menu_choice == 2: modules_names_list, modules_codes_list = load_modules() else: break
def menu(): print(f"Module Record System - Options\n------------------------------") print(" 1. Record Attendance \n 2. Generate Statistics\n 3. Exit") menu_choice = reading_from_user.read_range_integer(">", 1, 3) return menu_choice