-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path18.1.py
More file actions
94 lines (67 loc) · 2.66 KB
/
18.1.py
File metadata and controls
94 lines (67 loc) · 2.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
from random import randint
class ArtWork:
def __init__(self, title=None, year=None, author=None, genre=None) -> None:
self.create(title, year, author, genre)
def create(self, title=None, year=None, author=None, genre=None):
self.title = title
self.year = year
self.author = author
self.genre = genre
def input(self):
self.title = input('Title: ')
self.year = input('Year: ')
self.author = input('Author: ')
self.genre = input('Genre: ')
def output(self):
print(self.title, self.year, self.author, self.genre)
class Technique:
def __init__(self, name=None, material=None) -> None:
self.create(name, material)
def create(self, name=None, material=None):
self.name = name
self.material = material
def input(self):
self.name = input('Name: ')
self.material = input('Material: ')
def output(self):
print(self.name, self.material)
class Painting(ArtWork, Technique):
def __init__(self, title=None, year=None, author=None, genre=None, name=None, material=None, width=None, height=None, price=None):
self.create(title, year, author, genre, name, material, width, height, price)
def create(self, title=None, year=None, author=None, genre=None, name=None, material=None, width=None, height=None, price=None):
ArtWork().__init__(title, year, author, genre)
Technique().__init__(name, material)
self.width = width
self.height = height
self.price = price
def input(self):
ArtWork.input(self)
Technique.input(self)
self.width = int(input('Width: '))
self.height = int(input('Height: '))
self.price = int(input('Price: '))
def output(self):
ArtWork.output(self)
Technique.output(self)
print(self.width, self.height, self.price)
if __name__ == '__main__':
n = int(input('n = '))
painting_list = []
for _ in range(n):
painting = Painting()
painting.input()
painting_list.append(painting)
for painting in painting_list:
painting.output()
m = int(input('m = '))
lst = []
for _ in range(m):
l = input('Учасник: ')
lst.append(l)
for painting in painting_list:
prices = {l:randint(1, 1000) for l in lst}
max_price = max(prices.values())
for k, v in prices.items():
if max_price == v:
print(f'Клієнт {k} купив картину {painting} за {max_price} грн')
break