Question
I need to re-enter the loop after I have made an entry. My code is below. It needs to re-ask what option I need instead
I need to re-enter the loop after I have made an entry. My code is below. It needs to re-ask what option I need instead of repeating the same choice coursesList =[] courseOption = input("Enter A to add course, D to drop, or E to exit: ") courseOption = courseOption.upper() while(courseOption != 'E'): if courseOption == "A": addCourse = input ("Enter course to add:") if addCourse not in coursesList: coursesList.append(addCourse) coursesList.sort() print("Succesfully added course.") print("Registered courses:", coursesList) else: print("You are registered in that course.") elif courseOption == 'D': droppedCourse = input("Enter course to drop:") if droppedCourse in coursesList: coursesList.remove(droppedCourse) print("Course succesfully dropped.") print("Registered courses:", coursesList) else: print("You are not registered for that course.") else: print("Invalid entry.") courseOption = input("Enter A to add course, D to drop, or E to exit: ") courseOption = courseOption.upper()
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started