dasturlash

DOCX 4 pages 13.6 KB Free download

Page preview (4 pages)

Scroll down 👇
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

Want to read more?

Download all 4 pages for free via Telegram.

Download full file

About "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...

This file contains 4 pages in DOCX format (13.6 KB). To download "dasturlash", click the Telegram button on the left.

Tags: dasturlash DOCX 4 pages Free download Telegram