make a script explaining the python code line by line class Course: course_count = 0 def __init__(self, id_num, units, title): self.id_num = id_num self.units = units self.title = title Course.course_count += 1 def __str__(self): return f"ID: {self.id_num}, Title: {self.title}, Units: {self.units}" class CourseManager: def __init__(self): self.courses = [] def add_course(self, id_num, units, title): self.courses.append(Course(id_num, units, title)) def list_all_courses(self): if not self.courses: print("Your list is empty.") else: print("Your course list:\n") print("Course\t Unit\t Title") for course in self.courses: print(course.id_num," ",course.units,"\t ",course.title) def search_by_word(self, word): word = word.lower() result = [] for course in self.courses: if word in course.title.lower(): result.append(course) if not result: print(f"No courses found with the word '{word}' in the title.") else: print(f"All courses that has '{word}' in title:") print("Course\t Unit\t Title") for course in result: print(course.id_num," ",course.units,"\t ",course.title) def list_by_units(self, units): result = [] for course in self.courses: if course.units >= units: result.append(course) if not result: print(f"No courses found with units greater than or equal to {units}.") else: print("All courses that has unit >=",units,":") print("Course\t Unit\t Title") for course in result: print(course.id_num," ",course.units,"\t ",course.title) def main(): manager = CourseManager() while True: print("Please choose 1 of the following options:\n") print("\t1. List all courses") print("\t2. Add a course") print("\t3. Search word:show all the courses that has the word in the course title (ask the user for the word)") print("\t4. List >= input-unit: show all the courses that has unit >= input-unit(ask the user for input)") print("\t5. Exit\n") choice = int(input("Enter your option: ")) print("\n") if choice == 1: manager.list_all_courses() elif choice == 2: id_num = input("Enter the course ID: ") units = int(input("Enter the number of units: ")) title = input("Enter the title: ") manager.add_course(id_num, units, title) elif choice == 3: word = input("Enter the word to search for: ") manager.search_by_word(word) elif choice == 4: units = int(input("Enter the minimum number of units: ")) manager.list_by_units(units) elif choice == 5: break print() if name == "main": main()

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
make a script explaining the python code line by line class Course: course_count = 0 def __init__(self, id_num, units, title): self.id_num = id_num self.units = units self.title = title Course.course_count += 1 def __str__(self): return f"ID: {self.id_num}, Title: {self.title}, Units: {self.units}" class CourseManager: def __init__(self): self.courses = [] def add_course(self, id_num, units, title): self.courses.append(Course(id_num, units, title)) def list_all_courses(self): if not self.courses: print("Your list is empty.") else: print("Your course list:\n") print("Course\t Unit\t Title") for course in self.courses: print(course.id_num," ",course.units,"\t ",course.title) def search_by_word(self, word): word = word.lower() result = [] for course in self.courses: if word in course.title.lower(): result.append(course) if not result: print(f"No courses found with the word '{word}' in the title.") else: print(f"All courses that has '{word}' in title:") print("Course\t Unit\t Title") for course in result: print(course.id_num," ",course.units,"\t ",course.title) def list_by_units(self, units): result = [] for course in self.courses: if course.units >= units: result.append(course) if not result: print(f"No courses found with units greater than or equal to {units}.") else: print("All courses that has unit >=",units,":") print("Course\t Unit\t Title") for course in result: print(course.id_num," ",course.units,"\t ",course.title) def main(): manager = CourseManager() while True: print("Please choose 1 of the following options:\n") print("\t1. List all courses") print("\t2. Add a course") print("\t3. Search word:show all the courses that has the word in the course title (ask the user for the word)") print("\t4. List >= input-unit: show all the courses that has unit >= input-unit(ask the user for input)") print("\t5. Exit\n") choice = int(input("Enter your option: ")) print("\n") if choice == 1: manager.list_all_courses() elif choice == 2: id_num = input("Enter the course ID: ") units = int(input("Enter the number of units: ")) title = input("Enter the title: ") manager.add_course(id_num, units, title) elif choice == 3: word = input("Enter the word to search for: ") manager.search_by_word(word) elif choice == 4: units = int(input("Enter the minimum number of units: ")) manager.list_by_units(units) elif choice == 5: break print() if name == "main": main()
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Random access
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY