The python dictionary does not preserve the order of the elements.
You can use a special ordered dictionary type - OrderedDict.
For example, here’s how you can get OrderedDict correctly ordered from your dictionary and list:
from collections import OrderedDict source_dict = { "среда": "физика", "четверг": "русский", "понедельник": "схемотехника", "пятница": "выходной", "вторник": "география" } week = ["понедельник", "вторник", "среда", "четверг", "пятница"] result = OrderedDict() for day in week: result[day] = source_dict[day] print(result) # Вы получите: OrderedDict([('понедельник', 'схемотехника'), ('вторник', 'география'), ('среда', 'физика'), ('четверг', 'русский'), ('пятница', 'выходной')])
Well, or you can write a little more concise, if you are familiar with the generator expressions:
from collections import OrderedDict source_dict = { "среда": "физика", "четверг": "русский", "понедельник": "схемотехника", "пятница": "выходной", "вторник": "география" } week = ["понедельник", "вторник", "среда", "четверг", "пятница"] result = OrderedDict((day, source_dict[day]) for day in week) print(result) # Результат тот же самый
UPD: A little corrected in accordance with the comments from Timofey Bondarev - for which he thanks.