l=[100, 60, 80]
p={i:[] for i in l}
for i in l:
for weight in range(100):
for lenght in range(100):
if weight*2 + lenght<=i:
p[i].append((weight * lenght, weight, lenght))
for i in p.keys():
print(i, max(p[i], key=lambda x: x[0]))
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
l=[100, 60, 80]
p={i:[] for i in l}
for i in l:
for weight in range(100):
for lenght in range(100):
if weight*2 + lenght<=i:
p[i].append((weight * lenght, weight, lenght))
for i in p.keys():
print(i, max(p[i], key=lambda x: x[0]))