Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database Administration The Essential Reference

Authors: Brian Laskey, David Kreines

1st Edition

1565925165, 978-1565925168

More Books

Students also viewed these Databases questions