Question: PYTHON PROGRAMMING: Write a program for course registration. Students can use this program to add and drop courses. There should be a loop in the

PYTHON PROGRAMMING:

Write a program for course registration. Students can use this program to add and drop courses. There should be a loop in the program that tells the user to enter A to add course, D to drop course or E to exit. If A is chosen, ask the user to enter the course to add. If the user is already registered in that course, display the message You are already registered in that course; otherwise, add the course to the users course list, display the message Course added, sort the list and display the list. If the user chooses D, ask the user to enter the course to drop. If the user is not registered in that course, display the message You are not registered in that course; otherwise, remove the course from the users course list, display the message Course dropped and display the list. The loop will stop when the user enters E.

The following is an example:

Enter A to add course, D to drop course, and E to exit: A

Enter course to add: CSC151

Course added

Courses registered: ['CSC151']

Enter A to add course, D to drop course, and E to exit: A

Enter course to add: CSC134

Course added

Courses registered: ['CSC134', 'CSC151']

Enter A to add course, D to drop course, and E to exit: A

Enter course to add: CSC139

Course added

Courses registered: ['CSC134', 'CSC139', 'CSC151']

Enter A to add course, D to drop course, and E to exit: D

Enter course to drop: CSC134

Course dropped

Courses registered: ['CSC139', 'CSC151']

Enter A to add course, D to drop course, and E to exit: A

Enter course to add: CSC151

You are already registered in that course

Enter A to add course, D to drop course, and E to exit: A

Enter course to add: CSC121

Course added

Courses registered: ['CSC121', 'CSC139', 'CSC151']

Enter A to add course, D to drop course, and E to exit: E

**Cannot use def function as we have not covered this in class.

This was my attempt, but the program isn't working as it should. This attempt was with "while again" but I also tried "while True:" and also could not get the program to work

again = 'A' while again == 'A' or again == 'D' or again == 'E': student_decision = input(' Enter A to add course, D to drop course, or E to exit: ') student_decision = student_decision.upper() course_list = [] if student_decision == 'A': add_course = input('Enter the course to add: ') add_course.upper() if add_course in course_list: print('You are already registered in that course. ') print('Courses Registered: ', course_list) else: course_list.append(add_course) print('Course added.') course_list.sort() print('Courses registered: ', course_list) elif student_decision == 'D': del_course = input('Enter the course to drop: ') del_course.upper() if del_course in course_list: course_list.remove(del_course) print('Course dropped') print('Courses registered: ', course_list) else: print('You are not registered for that course.') print('Courses registered: ', course_list) elif student_decision == 'E': print('You have exited the program.') break again = input('Enter A to add, D to drop, or E to exit: ') again = again.upper() 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!