S
S
s4q2020-06-19 20:31:08
Python
s4q, 2020-06-19 20:31:08

How to access this dictionary?

There is a mrs dictionary, its content is as follows:

{'Пирожок манго-маракуйя': '58 ₽'}
{'Пирожок Вишневый': '50 ₽'}
{'Салфетка влажная': '2 ₽'}
{'Соус Терияки': '29 ₽'}
{'Соус Чесночный': '29 ₽'}
{'Соус Сырный': '29 ₽'}
{'Соус Кисло-Сладкий': '29 ₽'}
{'Соус Барбекю': '29 ₽'}
{'Соус Горчичный': '29 ₽'}
{'Соус Тысяча Островов': '29 ₽'}
{'Соус Сладкий Чили': '29 ₽'}
{'Кетчуп': '29 ₽'}
{'Молочный Коктейль Клубничный': '104 ₽'}


How can I contact him for a price?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
soremix, 2020-06-19
@s4q

This is not a dictionary, but a list of dictionaries.

def get_price(name):
    for el in mrs:
        if list(el.keys())[0] == name:
            return list(el.values())[0]

A
ankomserg, 2020-06-19
@ankomserg

price_mango = mrs['Пирожок манго-маракуйя']

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question