Question: PYTHON 3.6 Question 11A (12 points) Write a definition line for a class named State and a one-line doc string that describes what a State

PYTHON 3.6

PYTHON 3.6 Question 11A (12 points) Write a definition line for a

Question 11A (12 points) Write a definition line for a class named State and a one-line doc string that describes what a State is. Write definitions for the following methods (functions) in the code for the class: 1. An initialization method. The initialization method should: - Take a string parameter, name, and assign it as variable name of the state being created Create a list variable, universities, for the state being created and initialize it to the empty list Amethod named addUniversity. This method should take the name of a university as a string parameter and add it to the list of universities for a that state 2. 3. Amethod named is_home_of. This method should take the name of a university as a string parameter. If the university is in the state's list of universities it should retum True, otherwise it should return False. Question 11B (8 points) Assume that the code for the class State (Question 11A) has been saved in a file named state py. Write code that performs the following tasks (each task takes one line) 1. 2. 3. 4. import the module that defines the class State create a state named New Jersey add universities NJIT and Princeton to New Jersey check whether New Jersey is home of MIT and print the result

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!