1й способ:
min_prices = dict()
for k, v in sweets.items():
min_prices[k] = dict()
for counter, i in enumerate(v):
if counter == 0:
min_prices[k]['price'] = i['price']
min_prices[k]['shop'] = i['shop']
continue
if i['price'] < min_prices[k]['price']:
min_prices[k]['price'] = i['price']
min_prices[k]['shop'] = i['shop']
pprint(min_prices)
{'карамель': {'price': 41.99, 'shop': 'магнит'},
'конфеты': {'price': 30.99, 'shop': 'магнит'},
'печенье': {'price': 9.99, 'shop': 'пятерочка'},
'пирожное': {'price': 59.99, 'shop': 'пятерочка'}}
2й способ:
min_prices = {k: min(v, key=lambda x: x['price']) for k, v in sweets.items()}
pprint(min_prices)
{'карамель': {'price': 41.99, 'shop': 'магнит'},
'конфеты': {'price': 30.99, 'shop': 'магнит'},
'печенье': {'price': 9.99, 'shop': 'пятерочка'},
'пирожное': {'price': 59.99, 'shop': 'пятерочка'}}