Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class CPU:
- def __init__(self, name, freq):
- self.name = name
- self.fr = freq
- class Memory:
- def __init__(self, name, size):
- self.name = name
- self.volume = size
- class MotherBoard:
- def __init__(self, name, cpu, memory):
- self.name = name
- self.cpu = cpu
- self.total_mem_slots = 4
- self.mem_slots = memory[:4]
- def get_config(self):
- arr = []
- arr.append('Материнская плата: '+ self.name)
- arr.append('Центральный процессор: '+ self.cpu.name + ' ,' + str(self.cpu.fr))
- arr.append('Слотов памяти: ' + str(self.total_mem_slots))
- temp_arr = []
- for i in range(len(self.mem_slots)):
- temp_arr.append(self.mem_slots[i].name + ' - ' + str(self.mem_slots[i].volume) + ';')
- arr.append('Память: ' + ''.join(temp_arr))
- arr[3] = arr[3][:-1] # последняя ; не нужна
- return(arr)
- cpu = CPU('asus', 1333)
- mem1, mem2 = Memory('Kingstone', 4000), Memory('Kingstone', 4000)
- mb = MotherBoard('Asus', cpu, [mem1, mem2])
- print(mb.get_config())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement