Very quice questions in the file attached ( I answered all of them except these two ) I need someone to review my anserer and to answer the last two
Thanks
Question 9
1 pts
The following code starts the definition of a class called Address. The class needs to have two attributes: number and streetName. Please add in the two lines of code that will create these attributes from the appropriate passed in parameters.
class Address(object):
def __init__(self, number, streetName):
# Line 1: Creating a number attribute
# Line 2: Creating a streetName attribute
- What is the correct expression for
# Line 1? - What is the correct expression for
# Line 2?
Question 10
1 pts
Consider the following code:
class Clock(object):
def __init__(self, time):
self.time = time
def print_time(self):
time = '6:30'
print(self.time)
clock = Clock('5:30')
clock.print_time()
What does the code print out?


0 comments