hello, this problem is give some trouble about it? my code # Dictionary to store course prerequisites course_prerequisites = { "CS111": "None", "CS141": "None", "CS151": "None", "CS211": "CS141, CS151", "CS251": "CS211", "CS261": "CS211", "CS277": "None", "CS377": "CS277", "CS341": "CS211, CS251, CS261", } # Print the header print("--------------------------------") print(" UIC CS Track") print("--------------------------------\n") # Ask the user for a course name course_name = input("Enter a subject abbreviation and course number (CS111 for example): ") # Check if the course name is in the dictionary if course_name in course_prerequisites: prerequisites = course_prerequisites[course_name] print(f"Prerequisites for {course_name}: {prerequisites}") else: print(f"Course {course_name} not found in the list of CS courses.") # Goodbye message print("\nThank you for using App!") print("Closing app...")
hello, this problem is give some trouble about it?
my code
1. Create a dictionary named course_prerequisites to store course prerequisites.
Initialize it with key-value pairs where keys are course names and values are prerequisites.
2. Print a header to indicate the start of the program.
3. Prompt the user to enter a course name (e.g., "CS111").
4. Read and store the entered course name in the variable course_name.
5. Check if course_name exists in the course_prerequisites dictionary:
a. If it exists:
- Retrieve the prerequisites for the entered course (course_prerequisites[course_name]).
- Split the prerequisites by commas and remove extra spaces.
- Check if the prerequisites list is ["None"]:
- If yes, print that there are no prerequisites for the course.
- If no, print the list of prerequisites.
b. If it does not exist:
- Print a message indicating that the course was not found in the list of CS courses.
6. Print a thank-you message and indicate the app is closing.
7. End of the program.
Step by step
Solved in 4 steps with 2 images