Practice

This time, we've just got one big wrap-up problem

Car

A new car is said to devalue 20% in the first year. Assuming that this trend continues and that mileage divided by 100 is all you subtract from this adjusted price, make a class β€œcar” that has at least the attributes year, original price (aka og_price), and mileage. Also, follow these guidelines.

<aside> πŸ’‘ If you need help with modeling the equation for the adjusted price, this may help: self.adjustedprice = self.ogprice * (0.8**(2021-self.year)) self.adjustedprice = round((self.adjustedprice, 2)) - self.mileage/100

</aside>

πŸ’» Template code

βœ… Solution code

Previous Section

13.4 Comparison Operators

Next Section

(Optional) Other Special Methods

<aside> βš–οΈ Copyright Β© 2021 Code 4 Tomorrow. All rights reserved. The code in this course is licensed under the MIT License.

If you would like to use content from any of our courses, you must obtain our explicit written permission and provide credit. Please contact [email protected] for inquiries.

</aside>