Last active
November 6, 2021 08:56
-
-
Save keobox/2f9ac9d5c231f1d1a983568d39a12ec2 to your computer and use it in GitHub Desktop.
Car database
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Car: | |
def __init__(self, name, color, hp): | |
self.name = name | |
self.color = color | |
self.hp = hp | |
car_db = {"alboreto": Car("Ferrari", "Red", 2000), "senna": Car("McLaren", "White", 2000)} | |
assert car_db["alboreto"].name == "Ferrari" | |
assert car_db["senna"].name == "McLaren" | |
ferrari = car_db["alboreto"] | |
assert ferrari.color == "Red" | |
print("OK") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment