Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

семестр 1 / task-1

.py
Скачиваний:
0
Добавлен:
13.05.2026
Размер:
1.28 Кб
Скачать
class Tele:

	def chsetLG(self):
		self.mt = "IPS"
		self.cl = "Black"
		self.pr = 50000

	def chsetSN(self):
		self.mt = "VA"
		self.cl = "Silver"
		self.pr = 40000

	def chsetPH(self):
		self.mt = "OLED"
		self.cl = "White"
		self.pr = 45000

	def __init__(self, st):
		check_str = True
		
		try:
			str(st)
		except:
			check_str = False
		
		if check_str == True:
			self.mod = st
		else:
			print("Invalid operation")
		
		if self.mod == "LG":
			self.chsetLG()
		elif self.mod == "SN":
			self.chsetSN()
		elif self.mod == "PH":
			self.chsetPH()

	def tv(self):
		print(f'Model of chosen TV: {self.mod}')
		print(f'Matrix type of chosen TV: {self.mt}')
		print(f'Body color of chosen TV: {self.cl}')
		print(f'Price of chosen TV: {self.pr}{chr(10)}')

class Moni(Tele):

	def chsetLG(self):
		self.mt = "IPS"
		self.cl = "Black"
		self.pr = 50000

	def chsetSN(self):
		self.mt = "TN"
		self.cl = "Silver"
		self.pr = 4000

	def chsetPH(self):
		self.mt = "TFT"
		self.cl = "White"
		self.pr = 450


	def mn(self):
		print(f'Model: {self.mod}')
		print(f'Matrix type: {self.mt}')
		print(f'Body color: {self.cl}')
		print(f'Price: {self.pr}{chr(10)}')	

TV = Tele("LG")
TV.tv()
MN = Moni("SN")
MN.mn()
Соседние файлы в папке семестр 1