Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Первое заданиее
- def is_year_leap(year) -> bool:
- return year % 4 == 0
- print(is_year_leap(2000))
- # Второе задание
- def season(month) -> str:
- if month == 12 or month == 1 or month == 2:
- return "Winter"
- elif month == 3 or month == 4 or month == 5:
- return "Spring"
- elif month == 6 or month == 7 or month == 8:
- return "Summer"
- elif month == 9 or month == 10 or month == 11:
- return "Autumn"
- elif month == 0 or month > 12:
- return "Wrong input"
- print(season(12))
- # Словарь с машинами
- class Car:
- def __init__(self, model, body, engine_capacity, cost, color, country):
- self.model = model
- self.body = body
- self.engine_capacity = engine_capacity
- self.cost = cost
- self.color = color
- self.country = country
- def info(self):
- print(f"{self.model}, {self.body}, {self.engine_capacity}, {self.cost}, {self.color}, {self.country}")
- cars = dict()
- cars["Nissan"] = []
- cars["Toyota"] = []
- cars["Subaru"] = []
- cars[""] = []
- cars["Mazda"] = [Car("CX-5", "кроссовер", "2,2л", "2645000руб", "красный", "Япония")]
- cars["Mazda"][0].info()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement