dasturlash

DOCX 4 стр. 13,6 КБ Бесплатная загрузка

Предварительный просмотр (4 стр.)

Прокрутите вниз 👇
1 / 4
1 >> class book: def __init__(self, title, author, year, pages): self.title = title self.author = author self.year = year self.pages = pages def display_info(self): print(f"nazvanie: {self.title}, avtor: {self.author}, god: {self.year}, stranits: {self.pages}") book1 = book("prestuplenie i nakazanie", "f.m. dostoevskiy", 1866, 671) book1.display_info() 2 >> class rectangle: def __init__(self, width, height): self.width = width self.height = height def area(self): return self.width * self.height def perimeter(self): return 2 * (self.width + self.height) def is_square(self): return self.width == self.height rect1 = rectangle(5, 3) print(rect1.area()) print(rect1.perimeter()) print(rect1.is_square()) rect2 = rectangle(4, 4) print(rect2.is_square()) 3 >> class counter: def __init__(self, start=0): self._count = start def increment(self): self._count += 1 def decrement(self): self._count -= 1 def get_value(self): return self._count counter = counter(10) counter.increment() counter.increment() counter.decrement() print("tekushee znachenie:", counter.get_value()) 4 >> class wallet: def __init__(self, balance=0): self.balance = balance def add_money(self, amount): if amount > 0: self.balance += amount else: print("oshibka: summa doljna bit polojitelnoy!") def spend_money(self, amount): …
2 / 4
ion = new_description task1 = task("kupit moloko") task1.display_task() task1.mark_completed() task1.display_task() task2 = task("prochitat knigu") task2.display_task()
3 / 4
dasturlash - Page 3
4 / 4
dasturlash - Page 4

Хотите читать дальше?

Скачайте все 4 страниц бесплатно через Telegram.

Скачать полный файл

О "dasturlash"

1 >> class book: def __init__(self, title, author, year, pages): self.title = title self.author = author self.year = year self.pages = pages def display_info(self): print(f"nazvanie: {self.title}, avtor: {self.author}, god: {self.year}, stranits: {self.pages}") book1 = book("prestuplenie i nakazanie", "f.m. dostoevskiy", 1866, 671) book1.display_info() 2 >> class rectangle: def __init__(self, width, height): self.width = width self.height = height def area(self): return self.width * self.height def perimeter(self): return 2 * (self.width + self.height) def is_square(self): return self.width == self.height rect1 = rectangle(5, 3) print(rect1.area()) print(rect1.perimeter()) print(rect1.is_square()) rect2 = rectangle(4, 4) print(rect2.is_square()) 3 >> class counter: def __init__(self, start...

Этот файл содержит 4 стр. в формате DOCX (13,6 КБ). Чтобы скачать "dasturlash", нажмите кнопку Telegram слева.

Теги: dasturlash DOCX 4 стр. Бесплатная загрузка Telegram