Q18) Suppose, we are given a class called Car that has the following 3 attributes named model (string), year (int) and price (float). The function named find_car() takes three input parameters as follows: an object my_car of Car class, a string my_model, and an int age. This function returns True if my_car's model matches the given model and my_car is not more than age years old. Otherwise it returns False Choose the best option to fill the gap on Line# 2. (my_car.my_model == model) and (2022 - my_car.age) <= year (my_car.my_model == model) or (2022 - my_car.age) <= year (my_car.model == my_model) and (2022 - my_car.year) <= age (my_model == model) and (2022 - age) <= year (my_car.model == my_model) or (2022 - my_car.year) <= age
Q18)
Suppose, we are given a class called Car that has the following 3 attributes named model (string), year (int) and price (float).
The function named find_car() takes three input parameters as follows: an object my_car of Car class, a string my_model, and an int age. This function returns True if my_car's model matches the given model and my_car is not more than age years old. Otherwise it returns False
Choose the best option to fill the gap on Line# 2.
|
(my_car.my_model == model) and (2022 - my_car.age) <= year |
|
(my_car.my_model == model) or (2022 - my_car.age) <= year |
|
(my_car.model == my_model) and (2022 - my_car.year) <= age |
|
(my_model == model) and (2022 - age) <= year |
|
(my_car.model == my_model) or (2022 - my_car.year) <= age |
Step by step
Solved in 3 steps