def Menu(): print(""" Hey Buddy. You have couple options: [1] - Enter grades for existing name [2] - Remove Student [3] - Add Student [4] - Calculate average grade for every student [0] - Close the program """) users_choice = input("\n") print("choice", users_choice) if users_choice == '1': print("Choice is ", users_choice) functions.enter_grade() elif users_choice == '2': functions.remove_student() elif users_choice == '3': functions.add_student() elif users_choice == '4': functions.calculate_average() elif users_choice == '0': print("Thank you buddy, have a good day!") login.Exit()
def test_add_student_should_add_a_single_student_given_a_single_id_and_name(): # arrange student_id = 123 student_name = "Kevin" # act assert len(functions.students) == 0 functions.add_student(student_id, student_name) # assert assert len(functions.students) == 1
def start(): print("Welcome to - Student Informatin System") print("1.List System\n2.Add Student\n3.Add Teacher\n4.Calculate GPA") selection = input() if selection == "1": print("1.Students\n2.Teachers") sub_selection = input() if sub_selection == "1": func.list_students() elif sub_selection == "2": func.list_teachers() else: print("Please choose valid manu item.") elif selection == "2": func.add_student() elif selection == "3": func.add_teacher() elif selection == "4": func.calc_gpa() else: print("Please choose valid menu item") start()
def test_add_student_should_add_three_students_given_three_ids_and_names(): # arrange student_id_1 = 123 student_name_1 = "Kevin" student_id_2 = 456 student_name_2 = "Kim" student_id_3 = 789 student_name_3 = "Attie" # act assert len(functions.students) == 0 functions.add_student(student_id_1, student_name_1) functions.add_student(student_id_2, student_name_2) functions.add_student(student_id_3, student_name_3) # assert assert len(functions.students) == 3
def main(): show_menu() choice = get_choice() while choice != -1: if choice == 1: add_student() show_menu() elif choice == 2: add_faculty() show_menu() elif choice == 3: add_book() show_menu() elif choice == 4: issue_book_student() show_menu() elif choice == 5: issue_book_facutly() show_menu() elif choice == 6: return_book_student() show_menu() elif choice == 7: return_book_facutly() show_menu() elif choice == 8: show_search_menu() while True: try: src_choice = get_search_choice() break except ValueError: print('Invalid Input. Try again.') while src_choice != -1: if src_choice == 1: try: data = int(input('Enter ISBN-13: ')) except ValueError: print('Invalid Input, Enter A number.') else: search_book('i', data) elif src_choice == 2: try: data = input('Enter Title of book: ') except ValueError: print('Invalid Input.') else: search_book('t', data) elif src_choice == 3: try: data = input('Enter Author Name: ') except ValueError: print('Invalid Input.') else: search_book('a', data) else: print('Invalid Input. Try again.') show_search_menu() src_choice = get_search_choice() elif choice == 9: print_student_details() show_menu() elif choice == 10: print_faculty_details() show_menu() elif choice == 11: print_book_details() show_menu() else: print('Invalid Choice, Enter Choice Again.') show_menu() choice = get_choice()
def main(): op = 0 while op != 14: print('---' * 40) print('\t********Library Management System***********') print('---' * 40) print('\tpress 1 for Add Student') print('\tpress 2 for Add Faculty') print('\tpress 3 for Add Book') print('\tpress 4 for issue book for Student') print('\tpress 5 for issue book for faculty') print('\tpress 6 for search book') print('\tpress 7 for search student') print('\tpress 8 for search faculty') print('\tpress 9 for return book from Student') print('\tpress 10 for return book from faculty') print('\tpress 11 for display information of student') print('\tpress 12 for display information of faculty') print('\tpress 13 for display information of books') print('\tpress 14 for Exit') print('---' * 40) op = int(input('Enter choice :: ')) print('---' * 40) print( "[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ Please carefully filled the entry ]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]" ) if (op == 1): f.add_student() elif (op == 2): f.add_faculty() elif (op == 3): f.add_books() elif (op == 4): f.book_issue() elif (op == 5): f.book_issue_fac() elif (op == 6): if os.path.exists('Books.pkl') is True: with open('Books.pkl', 'rb') as b: isbn = input('Enter book ISBN :: ').upper() f.search(b, isbn, 3) else: print('No any directory') elif (op == 7): if os.path.exists('Student.pkl') is True: with open('Student.pkl', 'rb') as b: stu = input('Enter Student ID :: ').upper() f.search(b, stu, 1) else: print('No any directory') elif (op == 8): if os.path.exists('Faulty.pkl') is True: with open('Faculty.pkl', 'rb') as b: fac = input('Enter Faculty ID :: ').upper() f.search(b, fac, 2) else: print('No any directory') elif (op == 9): f.return_student() elif (op == 10): f.return_faculty() elif (op == 11): f.display_student() elif (op == 12): f.display_faculty() elif (op == 13): f.display_books() elif (op == 14): print("*************** Thankyou ********************") break else: print("Invalid choice")