Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I put in a screenshot of what I have so far and I know it's wrong. If you could help me with this, it would
I put in a screenshot of what I have so far and I know it's wrong. If you could help me with this, it would be greatly appreciated. Thank you.
Class Homework 1 CS 100 2017F Due (section dependent) Submit your solutions to Problems 1-5 below as file named university:py via Moodle. Problem 1. Write a class definition line and a one line docstring for the class Course_Section. Write an initmethod for the class Course Section that gives each Course Section its own section number and course name. Make sure that you test this on a successful creation of a Course Section object. For example, import university o> si-university. Course Section( l, S1007) sl.course name CS100 Problem 2. Add a list attribute enrolled students to each Course_Section and initialize it in initto a empty list. (The user does not have to supply a list of students enrolled in the course section when creating a Course Section.) Make sure that you test this successfully 3sl enrolled students Problem 3. Write a method enroll as part of the class Course Section. The method enroll should add a passed tuple parameter to enrolled sudents only if the tuple does not exists already in the list. The first item in the tuple is the name of the student and the second item is the ucid of the students. The enroll method will print a message confirming the enrollment of the student if the tuple gets added to the list otherwise it will print a message that the students is already enrolled. > sl.enroll".John', 'j24.)) John with ucidJ24 has successfully enrolled in section 1 ofCSI 00. >>> sl.enroll(("Jahn-,-j24,)) already enrolled!! Problem 4. Write a method drop as part of the class Course_Section. The method drop should check whether a passed tuple (student name, ucid) is in the enrolled_students list or not. If the tuple exists in the list then the method removes that tuple and prints that the student is successfully dropped otherwise prints that the student does not exist. dropl( John', 'j24) John with ucid j24 has been successfully dropped from section I of CS100! > sl dropi(' Tom', 't32')) Tom with ucid 132 does not exist in section I of CS100. Problem 5. Create a data attribute university as part of the class Course_Section and set its value to NJIT. The attribute university should be defined within the class Course Section but outside of any method. NJIT sl.university NJITStep 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