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...")

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

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...")

 

UIC CS Track
-------
Enter a subject abbreviation and course number (CS111 for example): CS111
Prerequisites for CS111: None
LLLL
Thank you for using App!
Closing app...
------
m
UIC CS Track
Enter a subject abbreviation and course number (CS111 for example): CS341
Prerequisites for CS341: CS211, CS251, CS261
Thank you for using App!
Closing app...
----
UIC CS Track
---
---
Enter a subject abbreviation and course number (CS111 for example): CS377
Prerequisites for CS377: CS277
Thank you for using App!
Closing app..-
Transcribed Image Text:UIC CS Track ------- Enter a subject abbreviation and course number (CS111 for example): CS111 Prerequisites for CS111: None LLLL Thank you for using App! Closing app... ------ m UIC CS Track Enter a subject abbreviation and course number (CS111 for example): CS341 Prerequisites for CS341: CS211, CS251, CS261 Thank you for using App! Closing app... ---- UIC CS Track --- --- Enter a subject abbreviation and course number (CS111 for example): CS377 Prerequisites for CS377: CS277 Thank you for using App! Closing app..-
Expert Solution
Step 1: Providing the algorithm


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.


steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Dictionary
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education