From d8ba3bebd53f6160b900be6147eecdf10ccf11d9 Mon Sep 17 00:00:00 2001 From: Adam Jurkiewicz Pythonista Local Date: Fri, 19 Dec 2025 10:40:16 +0100 Subject: [PATCH] k --- dzien_05/klasy_03_tl copy.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 dzien_05/klasy_03_tl copy.py diff --git a/dzien_05/klasy_03_tl copy.py b/dzien_05/klasy_03_tl copy.py new file mode 100644 index 0000000..d155936 --- /dev/null +++ b/dzien_05/klasy_03_tl copy.py @@ -0,0 +1,34 @@ +from random import randint, choice + +typy = ("XT8", "IBM PS/2", "AT206", "AT386", "AT386DX", + "Fijitsu", "Dell", "DEC", "Compaq", + "VAX OpemVMS", "IBM VM/360", "Z Series") + +komputery = [] + +class Computer: + def __init__(self, info: str, typ: str, speed: int): + print("Startujemy...") + # definicja właściwości obiektów tej lasy + self.procesor = "CPU at start" + self.speed = "5 GHz" + self.cpu_speed = speed + self.informacja = info + self.typ = typ + + def __str__(self): + return f"To jest {id(self)=}" + + def informacje(self): + if self.cpu_speed < 3000: + text = "- to jest wolny komputer" + else: + text = "- to jest szybki komputer" + return f"Info: {self.informacja} / {text}" + +for _ in range(5): + c_typ = choice(typy) + c_info = f"informacja o -> {c_typ}" + c_speed = randint(600, 6000) + comp = Computer(c_info, c_typ, c_speed) + komputery.append(comp) \ No newline at end of file