Solution 1

``````class Car(object):
def __init__(self, color, number_of_doors=4):
self.color = color
self.number_of_doors = number_of_doors
``````

# Make a Car with Doors!

Create a class `Car` that is initialized by providing one mandatory argument: `color`.
It will also have one optional/default argument `'number_of_doors'` set to be 4 if it is not received as an argument.

Example:

``````car1 = Car(color='blue', number_of_doors=2)
print(car1.color)  # 'blue'
print(car1.number_of_doors)  # 2

car2 = Car(color='green') # note that it is not passed `number_of_doors` argument
print(car2.color)  # 'green'
print(car2.number_of_doors)  # 4
``````

### Test Cases

test default num doors -

``````def test_default_num_doors():
car2 = Car(color='green')
assert isinstance(car2, object) is True

assert hasattr(car2, 'color') is True
assert car2.color == 'green'

assert hasattr(car2, 'number_of_doors') is True
assert car2.number_of_doors == 4
``````

test init attributes -

``````def test_init_attributes():
car1 = Car(color='blue', number_of_doors=2)

assert isinstance(car1, object) is True

assert hasattr(car1, 'color') is True
assert car1.color == 'blue'

assert hasattr(car1, 'number_of_doors') is True
assert car1.number_of_doors == 2
``````
# empty