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}" # TypeError: # Computer.__init__() # missing 1 required positional argument: # 'info' komputer1 = Computer("Komputer z lat 90tych", "XT", 1200) komputer2 = Computer("Inna informacja", "AT", 4000) print(komputer1) print('-------------------') print(dir(komputer1)) print(dir(komputer2)) print('-------------------') print(komputer1.procesor) print(komputer2.procesor) komputer1.procesor = "AMD M6" print('-------------------') print(komputer1.procesor) print(komputer2.procesor) print('-------------------') komputer1.nowe_property = "Jakaś tam" print(dir(komputer1)) print(dir(komputer2)) print('-------------------') # print(komputer1.informacje) # > print(komputer1.informacje())