Login and get codingIdentity and equality are two important concepts in Python. Please correct the mistakes in the Car class (marked with
# *
) and complete the functions below.Use the errors in the tests as guidance to what needs fixing. The
Car
class has twostatic
functions that should behave in the following way:>>> Car.age(1)
'Neither a week, nor a year old'
>>> Car.age(7)
'A week old'
>>> Car.age(365)
'A year old'
>>> config1 = ["manual", "radio"]
>>> config2 = ["manual", "radio"]
>>> config3 = ["manual"]
>>> Car.has_same_configuration(config1, config2)
True
>>> Car.has_same_configuration(config1, config3)
FalsePlease alo complete the two functions
is_same_car_color_and_model
andis_same_instance_of_car
to behave like this:>>> car1 = Car("Pickup", "black")
>>> car2 = Car("Pickup", "black")
>>> car3 = car1
>>> is_same_car_color_and_model(car1, car2)
True
>>> is_same_car_color_and_model(car1, car3)
True
>>> is_same_instance_of_car(car1, car2)
False
>>> is_same_instance_of_car(car1, car3)
TrueCheck out the articles below for additional pointers to solve the bite:
- What are the differences between type() and isinstance()?
Good luck and keep calm and code in Python!
110 out of 112 users completed this Bite.
Will you be Pythonista #111 to crack this Bite?
Resolution time: ~35 min. (avg. submissions of 5-240 min.)
Pythonistas rate this Bite 3.33 on a 1-10 difficulty scale.
» You can do it! 😌