52 lines
1.4 KiB
Python
52 lines
1.4 KiB
Python
|
scores = [
|
|||
|
60, 50, 60, 58, 54, 54, 58, 50, 52,
|
|||
|
54, 48, 69, 34, 55, 51, 52, 44, 51,
|
|||
|
69, 64, 66, 55, 52, 61, 46, 31, 57,
|
|||
|
52, 44, 18, 41, 53, 55, 61, 51, 44
|
|||
|
]
|
|||
|
costs = [
|
|||
|
.25, .27, .25, .25, .25, .25,
|
|||
|
.33, .31, .25, .29, .27, .22,
|
|||
|
.31, .25, .25, .33, .21, .25,
|
|||
|
.25, .25, .28, .25, .24, .22,
|
|||
|
.20, .25, .30, .25, .24, .25,
|
|||
|
.25, .25, .27, .25, .26, .29
|
|||
|
]
|
|||
|
# i = 0
|
|||
|
length = len(scores)
|
|||
|
max = 0
|
|||
|
min = 0
|
|||
|
max_list = []
|
|||
|
# while i < length:
|
|||
|
for i in range(length):
|
|||
|
print('Пузырьковый раствор #' + str(i), '- результат:', scores[i])
|
|||
|
# i += 1
|
|||
|
if max < scores[i]:
|
|||
|
max = scores[i]
|
|||
|
print('Пузырьковых тестов:', length)
|
|||
|
print('Наибольший результат:', max)
|
|||
|
for i in range(length):
|
|||
|
if scores[i] == max:
|
|||
|
max_list.append(i)
|
|||
|
|
|||
|
cost = 100.0
|
|||
|
most_effective = 0
|
|||
|
# for i in range(len(costs)):
|
|||
|
# if scores[i] == max and costs[i] <= cost:
|
|||
|
# most_effective = i
|
|||
|
# cost = costs[i]
|
|||
|
|
|||
|
# for i in max_list:
|
|||
|
# if costs[i] <= cost:
|
|||
|
# most_effective = i
|
|||
|
# cost = costs[i]
|
|||
|
|
|||
|
for i in range(len(max_list)):
|
|||
|
index = max_list[i]
|
|||
|
if cost > costs[index]:
|
|||
|
most_effective = index
|
|||
|
cost = costs[index]
|
|||
|
|
|||
|
print('Наибольший результат:', max_list)
|
|||
|
print('Раствор:', most_effective, 'самый выгодный, его цена -', cost)
|