values = [ 4, 7, 10, 5, 3]
max_value= max(values)
print(f'The maximum value in values is {max_value}. The index of the maximum value is {values.index(max_value)}. The list which is being evaluated is {values}')
The maximum value in values is 10. The index of the maximum value is 2. The list which is being evaluated is [4, 7, 10, 5, 3]
weights = [15, 8, 2, 6, 12 ]
max_weight=max(weights)
print(f'The weight corresponding to the item with the max value is {max_weight} ')
The weight corresponding to the item with the max value is 15
NameError: name 'weight' is not defined
values = [ 4, 7, 10, 5, 3] # we need to reload these lists because we modified them
weights = [15, 8, 2, 6, 12 ] # in loop above