Список преобразования Python в словарь: полное руководство

| | | | | | | | | | | | | | | | | | | | |

–í—ã –º–æ–∂–µ—Ç–µ –ø—Ä–µ–æ–±—Ä–∞–∑–æ–≤–∞—Ç—å —Å–ø–∏—Å–æ–∫ Python –≤ —Å–ª–æ–≤–∞—Ä—å, –∏—Å–ø–æ–ª—å–∑—É—è –ø–æ–Ω–∏–º–∞–Ω–∏–µ —Å–ª–æ–≤–∞—Ä—è, dict.fromkeys () –∏–ª–∏ –º–µ—Ç–æ–¥ zip (). –í—Å–µ —Ç—Ä–∏ –º–µ—Ç–æ–¥–∞ —Å–æ–∑–¥–∞—é—Ç –Ω–æ–≤—ã–π —Å–ª–æ–≤–∞—Ä—å. –û–Ω–∏ –Ω–µ –∏–∑–º–µ–Ω—è—é—Ç —Å—É—â–µ—Å—Ç–≤—É—é—â–∏–π —Å–ø–∏—Å–æ–∫.

–°–ø–∏—Å–∫–∏ –∏ —Å–ª–æ–≤–∞—Ä–∏ Python - —ç—Ç–æ –¥–≤–µ —Å—Ç—Ä—É–∫—Ç—É—Ä—ã, –∏—Å–ø–æ–ª—å–∑—É–µ–º—ã–µ –¥–ª—è —Ö—Ä–∞–Ω–µ–Ω–∏—è –¥–∞–Ω–Ω—ã—Ö. –ù–æ —á—Ç–æ, –µ—Å–ª–∏ –≤—ã —Ö–æ—Ç–∏—Ç–µ –ø—Ä–µ–æ–±—Ä–∞–∑–æ–≤–∞—Ç—å —Å–ø–∏—Å–æ–∫ –≤ —Å–ª–æ–≤–∞—Ä—å? –í—ã –º–æ–∂–µ—Ç–µ —Å–¥–µ–ª–∞—Ç—å —ç—Ç–æ, –µ—Å–ª–∏ —Ö–æ—Ç–∏—Ç–µ –ø—Ä–∏—Å–≤–æ–∏—Ç—å —É–Ω–∏–∫–∞–ª—å–Ω—É—é –º–µ—Ç–∫—É –∫–∞–∂–¥–æ–º—É —Å–æ—Ö—Ä–∞–Ω–µ–Ω–Ω–æ–º—É –≤–∞–º–∏ –∑–Ω–∞—á–µ–Ω–∏—é. –≠—Ç–æ –≤–æ–∑–º–æ–∂–Ω–æ —Ç–æ–ª—å–∫–æ –≤ —Å–ª–æ–≤–∞—Ä–µ.

–ï—Å—Ç—å –Ω–µ—Å–∫–æ–ª—å–∫–æ –º–µ—Ç–æ–¥–æ–≤ –∏ –≤—Å—Ç—Ä–æ–µ–Ω–Ω—ã—Ö —Ñ—É–Ω–∫—Ü–∏–π, –∫–æ—Ç–æ—Ä—ã–µ –≤—ã –º–æ–∂–µ—Ç–µ –∏—Å–ø–æ–ª—å–∑–æ–≤–∞—Ç—å –≤ Python –¥–ª—è –ø—Ä–µ–æ–±—Ä–∞–∑–æ–≤–∞–Ω–∏—è —Å–ø–∏—Å–∫–∞ –≤ —Å–ª–æ–≤–∞—Ä—å. –í —ç—Ç–æ–º —Ä—É–∫–æ–≤–æ–¥—Å—Ç–≤–µ –ø–æ –ø—Ä–æ–≥—Ä–∞–º–º–∏—Ä–æ–≤–∞–Ω–∏—é —Å–æ —Å—Å—ã–ª–∫–æ–π –Ω–∞ –ø—Ä–∏–º–µ—Ä—ã –±—É–¥–µ—Ç –æ–±—Å—É–∂–¥–∞—Ç—å—Å—è, –∫–∞–∫ –ø—Ä–µ–æ–±—Ä–∞–∑–æ–≤–∞—Ç—å —Å–ø–∏—Å–æ–∫ –≤ —Å–ª–æ–≤–∞—Ä—å –≤ Python.

–°–ø–∏—Å–∫–∏ –∏ —Å–ª–æ–≤–∞—Ä–∏ Python

–°–ø–∏—Å–∫–∏ –∏ —Å–ª–æ–≤–∞—Ä–∏ —è–≤–ª—è—é—Ç—Å—è –ø—Ä–∏–º–µ—Ä–∞–º–∏ –∫–æ–ª–ª–µ–∫—Ü–∏–π Python. –û–Ω–∏ –ø–æ–∑–≤–æ–ª—è—é—Ç —Ö—Ä–∞–Ω–∏—Ç—å –Ω–µ—Å–∫–æ–ª—å–∫–æ –ø–æ—Ö–æ–∂–∏—Ö –∑–Ω–∞—á–µ–Ω–∏–π –≤–º–µ—Å—Ç–µ –≤ –æ–¥–Ω–æ–π —Å—Ç—Ä—É–∫—Ç—É—Ä–µ –¥–∞–Ω–Ω—ã—Ö.

–°—Ç—Ä—É–∫—Ç—É—Ä–∞ –¥–∞–Ω–Ω—ã—Ö —Å–ø–∏—Å–∫–∞ –ø–æ–∑–≤–æ–ª—è–µ—Ç —Ö—Ä–∞–Ω–∏—Ç—å –¥–∞–Ω–Ω—ã–µ –≤ –æ–ø—Ä–µ–¥–µ–ª–µ–Ω–Ω–æ–º –ø–æ—Ä—è–¥–∫–µ. –í–æ—Ç –ø—Ä–∏–º–µ—Ä —Å–ø–∏—Å–∫–∞ Python:

–ù–∞—à —Å–ø–∏—Å–æ–∫ –ø–æ–¥ –Ω–∞–∑–≤–∞–Ω–∏–µ–º takeout_prices —Å–æ–¥–µ—Ä–∂–∏—Ç —á–µ—Ç—ã—Ä–µ –∑–Ω–∞—á–µ–Ω–∏—è.

–° –¥—Ä—É–≥–æ–π —Å—Ç–æ—Ä–æ–Ω—ã, —Å–ª–æ–≤–∞—Ä–∏ –Ω–µ—É–ø–æ—Ä—è–¥–æ—á–µ–Ω—ã –∏ –Ω–µ –º–æ–≥—É—Ç —Ö—Ä–∞–Ω–∏—Ç—å –Ω–µ—Å–∫–æ–ª—å–∫–æ –ø–æ–≤—Ç–æ—Ä—è—é—â–∏—Ö—Å—è –∑–Ω–∞—á–µ–Ω–∏–π.

–í–æ—Ç –ø—Ä–∏–º–µ—Ä —Å–ª–æ–≤–∞—Ä—è Python :

81% —É—á–∞—Å—Ç–Ω–∏–∫–æ–≤ –∑–∞—è–≤–∏–ª–∏, —á—Ç–æ —á—É–≤—Å—Ç–≤—É—é—Ç —Å–µ–±—è –±–æ–ª–µ–µ —É–≤–µ—Ä–µ–Ω–Ω–æ –≤ —Å–≤–æ–µ–π —Ç–µ—Ö–Ω–∏—á–µ—Å–∫–æ–π —Ä–∞–±–æ—Ç–µ –ø–µ—Ä—Å–ø–µ–∫—Ç–∏–≤—ã –ø–æ—Å–ª–µ –ø–æ—Å–µ—â–µ–Ω–∏—è —É—á–µ–±–Ω–æ–≥–æ –ª–∞–≥–µ—Ä—è. –ü—Ä–æ–π–¥–∏—Ç–µ –∫—É—Ä—Å –æ–±—É—á–µ–Ω–∏—è —Å–µ–≥–æ–¥–Ω—è.

–°—Ä–µ–¥–Ω–∏–π –≤—ã–ø—É—Å–∫–Ω–∏–∫ —É—á–µ–±–Ω–æ–≥–æ –ª–∞–≥–µ—Ä—è –ø–æ—Ç—Ä–∞—Ç–∏–ª –º–µ–Ω–µ–µ —à–µ—Å—Ç–∏ –º–µ—Å—è—Ü–µ–≤ –Ω–∞ –ø–µ—Ä–µ—Ö–æ–¥–Ω—É—é –∫–∞—Ä—å–µ—Ä—É, –æ—Ç –Ω–∞—á–∞–ª–∞ —É—á–µ–±–Ω–æ–≥–æ –ª–∞–≥–µ—Ä—è –¥–æ –ø–æ–∏—Å–∫–∞ —Å–≤–æ–µ–π –ø–µ—Ä–≤–æ–π —Ä–∞–±–æ—Ç—ã.

–°–ª–æ–≤–∞—Ä–∏ –ø–æ–ª–µ–∑–Ω—ã, –µ—Å–ª–∏ –≤—ã —Ö–æ—Ç–∏—Ç–µ —á—Ç–æ–±—ã —Å–≤—è–∑–∞—Ç—å –º–µ—Ç–∫–∏ —Å –∫–∞–∂–¥—ã–º –∑–Ω–∞—á–µ–Ω–∏–µ–º. –°–ø–∏—Å–∫–∏ –ª—É—á—à–µ, –µ—Å–ª–∏ –≤—ã —Ö—Ä–∞–Ω–∏—Ç–µ –ø–æ—Ö–æ–∂–∏–µ –¥–∞–Ω–Ω—ã–µ, —Ç–∞–∫–∏–µ –∫–∞–∫ —Å–ø–∏—Å–æ–∫ —Ü–µ–Ω –∏–ª–∏ –∏–º–µ–Ω, –≥–¥–µ –≤—ã –Ω–µ –º–æ–∂–µ—Ç–µ –º–∞—Ä–∫–∏—Ä–æ–≤–∞—Ç—å –∫–∞–∂–¥–æ–µ –∑–Ω–∞—á–µ–Ω–∏–µ.

Python Convert List to Dictionary

–í—ã –º–æ–∂–µ—Ç–µ –ø—Ä–µ–æ–±—Ä–∞–∑–æ–≤–∞—Ç—å Python list –≤ —Å–ª–æ–≤–∞—Ä—å —Å –ø–æ–º–æ—â—å—é –º–µ—Ç–æ–¥–∞ dict.fromkeys (), –ø–æ–Ω–∏–º–∞–Ω–∏—è —Å–ª–æ–≤–∞—Ä—è –∏–ª–∏ –º–µ—Ç–æ–¥–∞ zip (). –ú–µ—Ç–æ–¥ zip () –ø–æ–ª–µ–∑–µ–Ω, –µ—Å–ª–∏ –≤—ã —Ö–æ—Ç–∏—Ç–µ –æ–±—ä–µ–¥–∏–Ω–∏—Ç—å –¥–≤–∞ —Å–ø–∏—Å–∫–∞ –≤ —Å–ª–æ–≤–∞—Ä—å.

–î–∞–≤–∞–π—Ç–µ –±—ã—Å—Ç—Ä–æ —Ä–µ–∑—é–º–∏—Ä—É–µ–º —ç—Ç–∏ –º–µ—Ç–æ–¥—ã:

  • dict.fromkeys ( ): –∏—Å–ø–æ–ª—å–∑—É–µ—Ç—Å—è –¥–ª—è —Å–æ–∑–¥–∞–Ω–∏—è —Å–ª–æ–≤–∞—Ä—è –∏–∑ —Å–ø–∏—Å–∫–∞. –ü—Ä–∏ –∂–µ–ª–∞–Ω–∏–∏ –≤—ã –º–æ–∂–µ—Ç–µ —É—Å—Ç–∞–Ω–æ–≤–∏—Ç—å –∑–Ω–∞—á–µ–Ω–∏–µ –ø–æ —É–º–æ–ª—á–∞–Ω–∏—é –¥–ª—è –≤—Å–µ—Ö –∫–ª—é—á–µ–π. –í—ã –Ω–µ –º–æ–∂–µ—Ç–µ —É—Å—Ç–∞–Ω–æ–≤–∏—Ç—å –∏–Ω–¥–∏–≤–∏–¥—É–∞–ª—å–Ω—ã–µ –∑–Ω–∞—á–µ–Ω–∏—è –¥–ª—è –∫–∞–∂–¥–æ–≥–æ —ç–ª–µ–º–µ–Ω—Ç–∞ –≤ —Å–ª–æ–≤–∞—Ä–µ.
  • –ü–æ–Ω–∏–º–∞–Ω–∏–µ —Å–ª–æ–≤–∞—Ä—è: —Å–æ–∑–¥–∞–µ—Ç –Ω–æ–≤—ã–π —Å–ª–æ–≤–∞—Ä—å –∏–∑ —Å—É—â–µ—Å—Ç–≤—É—é—â–µ–≥–æ —Å–ø–∏—Å–∫–∞. –í—ã –º–æ–∂–µ—Ç–µ —É–∫–∞–∑–∞—Ç—å —Ä–∞–∑–Ω—ã–µ –∑–Ω–∞—á–µ–Ω–∏—è –¥–ª—è –∫–∞–∂–¥–æ–≥–æ –∫–ª—é—á–∞ –≤ —Å–ª–æ–≤–∞—Ä–µ. –ü–æ–Ω–∏–º–∞–Ω–∏–µ —Å–ª–æ–≤–∞—Ä—è –ø–æ —Å—Ç—Ä—É–∫—Ç—É—Ä–µ –ø–æ—Ö–æ–∂–µ –Ω–∞ –ø–æ–Ω–∏–º–∞–Ω–∏–µ —Å–ø–∏—Å–∫–∞ Python .
  • zip (): –ø—Ä–µ–æ–±—Ä–∞–∑—É–µ—Ç –¥–≤–∞ –∏–ª–∏ –±–æ–ª—å—à–µ —Å–ø–∏—Å–∫–æ–≤ –≤ —Å–ø–∏—Å–æ–∫ –∫–æ—Ä—Ç–µ–∂–µ–π. –í—ã –º–æ–∂–µ—Ç–µ –∏—Å–ø–æ–ª—å–∑–æ–≤–∞—Ç—å –º–µ—Ç–æ–¥ dict () –¥–ª—è –ø—Ä–µ–æ–±—Ä–∞–∑–æ–≤–∞–Ω–∏—è —Å–ø–∏—Å–∫–∞ –∫–æ—Ä—Ç–µ–∂–µ–π –≤ —Å–ª–æ–≤–∞—Ä—å.

–ú—ã —Å–æ–±–∏—Ä–∞–µ–º—Å—è –∏—Å–ø–æ–ª—å–∑–æ–≤–∞—Ç—å –∫–∞–∂–¥—ã–π –∏–∑ —Ç—Ä–µ—Ö –≤—ã—à–µ–ø–µ—Ä–µ—á–∏—Å–ª–µ–Ω–Ω—ã—Ö –º–µ—Ç–æ–¥–æ–≤, —á—Ç–æ–±—ã –ø—Ä–æ–¥–µ–º–æ–Ω—Å—Ç—Ä–∏—Ä–æ–≤–∞—Ç—å, –∫–∞–∫ –º—ã –º–æ–∂–µ–º –ø—Ä–µ–æ–±—Ä–∞–∑–æ–≤–∞—Ç—å —Å–ø–∏—Å–æ–∫ –≤ —Å–ª–æ–≤–∞—Ä—å.

Python Convert List to Dictionary: dict .fromkeys ()

–î–æ–ø—É—Å—Ç–∏–º, —É –Ω–∞—Å –µ—Å—Ç—å —Å–ø–∏—Å–æ–∫ —Ñ—Ä—É–∫—Ç–æ–≤, –∫–æ—Ç–æ—Ä—ã–µ –º—ã —Ö–æ—Ç–∏–º –ø—Ä–µ–≤—Ä–∞—Ç–∏—Ç—å –≤ —Å–ª–æ–≤–∞—Ä—å. –ö–∞–∂–¥–æ–º—É —Ñ—Ä—É–∫—Ç—É –¥–æ–ª–∂–Ω–æ –±—ã—Ç—å –ø—Ä–∏—Å–≤–æ–µ–Ω–æ –∑–Ω–∞—á–µ–Ω–∏–µ –ù–∞ —Å–∫–ª–∞–¥–µ:

–ú—ã –º–æ–≥–ª–∏ –±—ã —Å–æ–∑–¥–∞—Ç—å —ç—Ç–æ—Ç —Å–ª–æ–≤–∞—Ä—å —Å –ø–æ–º–æ—â—å—é –º–µ—Ç–æ–¥–∞ dict.fromkeys (). –≠—Ç–æ—Ç –º–µ—Ç–æ–¥ –ø—Ä–∏–Ω–∏–º–∞–µ—Ç —Å–ø–∏—Å–æ–∫ –∫–ª—é—á–µ–π, –∫–æ—Ç–æ—Ä—ã–µ –≤—ã —Ö–æ—Ç–∏—Ç–µ –ø—Ä–µ–æ–±—Ä–∞–∑–æ–≤–∞—Ç—å –≤ —Å–ª–æ–≤–∞—Ä—å. –ü—Ä–∏ –∂–µ–ª–∞–Ω–∏–∏ –≤—ã –º–æ–∂–µ—Ç–µ —É–∫–∞–∑–∞—Ç—å –∂–µ–ª–∞–µ–º–æ–µ –∑–Ω–∞—á–µ–Ω–∏–µ. –¥–ª—è –ø—Ä–∏—Å–≤–æ–µ–Ω–∏—è –∫–∞–∂–¥–æ–º—É –∫–ª—é—á—É.

–í—ã –º–æ–∂–µ—Ç–µ —É–∫–∞–∑–∞—Ç—å —Ç–æ–ª—å–∫–æ –æ–¥–Ω–æ –∑–Ω–∞—á–µ–Ω–∏–µ, –∫–æ—Ç–æ—Ä–æ–µ –±—É–¥–µ—Ç –Ω–∞–∑–Ω–∞—á–µ–Ω–æ –∫–∞–∂–¥–æ–º—É –∫–ª—é—á—É. –ù–µ–ª—å–∑—è —Å–∫–∞–∑–∞—Ç—å, —á—Ç–æ –æ–¥–∏–Ω –∫–ª—é—á –¥–æ–ª–∂–µ–Ω –∏–º–µ—Ç—å –æ–¥–Ω–æ –∑–Ω–∞—á–µ–Ω–∏–µ, –∞ –¥—Ä—É–≥–æ–π –∫–ª—é—á –¥–æ–ª–∂–µ–Ω –∏–º–µ—Ç—å –¥—Ä—É–≥–æ–µ t –∑–Ω–∞—á–µ–Ω–∏–µ.

–î–∞–≤–∞–π—Ç–µ –ø—Ä–µ–≤—Ä–∞—Ç–∏–º –Ω–∞—à —Å–ø–∏—Å–æ–∫ —Ñ—Ä—É–∫—Ç–æ–≤ –≤ —Å–ª–æ–≤–∞—Ä—å:

–ù–∞—à –∫–æ–¥ –≤–æ–∑–≤—Ä–∞—â–∞–µ—Ç –æ–±—ä–µ–∫—Ç—ã –∏–∑ —ç—Ç–æ–≥–æ —Å–ø–∏—Å–∫–∞ –≤ –æ–±—ä–µ–∫—Ç–µ —Å–ª–æ–≤–∞—Ä—è:

–°–Ω–∞—á–∞–ª–∞ –º—ã –æ–±—ä—è–≤–ª—è–µ–º –ü–µ—Ä–µ–º–µ–Ω–Ω–∞—è Python —Å –∏–º–µ–Ω–µ–º fruit, –≤ –∫–æ—Ç–æ—Ä–æ–π —Ö—Ä–∞–Ω—è—Ç—Å—è –∏–º–µ–Ω–∞ –∫–ª—é—á–µ–π, –∫–æ—Ç–æ—Ä—ã–µ –º—ã —Ö–æ—Ç–∏–º –∏—Å–ø–æ–ª—å–∑–æ–≤–∞—Ç—å –≤ –Ω–∞—à–µ–º —Å–ª–æ–≤–∞—Ä–µ.

–ú—ã –∏—Å–ø–æ–ª—å–∑—É–µ–º dict.fromkeys (), —á—Ç–æ–±—ã —Å–æ–∑–¥–∞—Ç—å —Å–ª–æ–≤–∞—Ä—å, –∏—Å–ø–æ–ª—å–∑—É—é—â–∏–π –∏–º–µ–Ω–∞ –∫–ª—é—á–µ–π, –∫–æ—Ç–æ—Ä—ã–µ –º—ã —Å–æ—Ö—Ä–∞–Ω–∏–ª–∏ –≤ –º–∞—Å—Å–∏–≤–µ fruit. –≠—Ç–æ—Ç –º–µ—Ç–æ–¥ –ø—Ä–∏—Å–≤–∞–∏–≤–∞–µ—Ç –∫–∞–∂–¥–æ–º—É –∫–ª—é—á—É –∑–Ω–∞—á–µ–Ω–∏–µ –í –Ω–∞–ª–∏—á–∏–∏. –ù–∞–∫–æ–Ω–µ—Ü, –º—ã –≤—ã–≤–æ–¥–∏–º –Ω–æ–≤—ã–π —Å–ª–æ–≤–∞—Ä—å –Ω–∞ –∫–æ–Ω—Å–æ–ª—å.

–ï—Å–ª–∏ –±—ã –º—ã –Ω–µ —É–∫–∞–∑–∞–ª–∏ –∑–Ω–∞—á–µ–Ω–∏–µ In stock –≤ –Ω–∞—à–µ–º –∫–æ–¥–µ, –∑–Ω–∞—á–µ–Ω–∏–µ–º –ø–æ —É–º–æ–ª—á–∞–Ω–∏—é –¥–ª—è –∫–ª—é—á–µ–π –≤ –Ω–∞—à–µ–º —Å–ª–æ–≤–∞—Ä–µ –±—ã–ª–æ –±—ã None .

–ü—Ä–µ–æ–±—Ä–∞–∑–æ–≤–∞–Ω–∏–µ —Å–ø–∏—Å–∫–∞ –≤ —Å–ª–æ–≤–∞—Ä—å Python: –ø–æ–Ω–∏–º–∞–Ω–∏–µ —Å–ª–æ–≤–∞—Ä—è

–ú—ã —Ç–∞–∫–∂–µ –º–æ–∂–µ–º –∏—Å–ø–æ–ª—å–∑–æ–≤–∞—Ç—å –º–µ—Ç–æ–¥, –Ω–∞–∑—ã–≤–∞–µ–º—ã–π –ø–æ–Ω–∏–º–∞–Ω–∏–µ —Å–ª–æ–≤–∞—Ä—è, —á—Ç–æ–±—ã –ø—Ä–µ–æ–±—Ä–∞–∑–æ–≤–∞—Ç—å —Å–ø–∏—Å–æ–∫ Python –≤ —Å–ª–æ–≤–∞—Ä—å, –∏—Å–ø–æ–ª—å–∑—É—è —Ç–æ—Ç –∂–µ –∑–Ω–∞—á–µ–Ω–∏—è.

–ü–æ–Ω–∏–º–∞–Ω–∏–µ —Å–ª–æ–≤–∞—Ä—è –ø–æ—Ö–æ–∂–µ –Ω–∞ –ø–æ–Ω–∏–º–∞–Ω–∏–µ —Å–ø–∏—Å–∫–∞ –≤ —Ç–æ–º, —á—Ç–æ –æ–±–∞ –º–µ—Ç–æ–¥–∞ —Å–æ–∑–¥–∞—é—Ç –Ω–æ–≤–æ–µ –∑–Ω–∞—á–µ–Ω–∏–µ —Å–≤–æ–∏—Ö —Å–æ–æ—Ç–≤–µ—Ç—Å—Ç–≤—É—é—â–∏—Ö —Ç–∏–ø–æ–≤ –¥–∞–Ω–Ω—ã—Ö. –ü–æ–Ω–∏–º–∞–Ω–∏–µ —Å–ª–æ–≤–∞—Ä—è –∏—Å–ø–æ–ª—å–∑—É–µ—Ç –∑–∞–æ—Å—Ç—Ä–µ–Ω–Ω—ã–µ —Å–∫–æ–±–∫–∏ ({}), —Ç–æ–≥–¥–∞ –∫–∞–∫ –ø–æ–Ω–∏–º–∞–Ω–∏–µ —Å–ø–∏—Å–∫–∞ –∏—Å–ø–æ–ª—å–∑—É–π—Ç–µ –∫–≤–∞–¥—Ä–∞—Ç–Ω—ã–µ —Å–∫–æ–±–∫–∏ ([]).

–î–∞–≤–∞–π—Ç–µ –ø—Ä–µ–æ–±—Ä–∞–∑—É–µ–º –Ω–∞—à —Å–ø–∏—Å–æ–∫ —Ñ—Ä—É–∫—Ç–æ–≤ –≤ —Å–ª–æ–≤–∞—Ä—å, –∏—Å–ø–æ–ª—å–∑—É—è –ø–æ–Ω–∏–º–∞–Ω–∏–µ —Å–ª–æ–≤–∞—Ä—è:

–ù–∞—à –∫–æ–¥ –≤–æ–∑–≤—Ä–∞—â–∞–µ—Ç:

–°–Ω–∞—á–∞–ª–∞ –º—ã –æ–±—ä—è–≤–∏–ª–∏ —Å–ø–∏—Å–æ–∫ –ø–æ–¥ –Ω–∞–∑–≤–∞–Ω–∏–µ–º fruit –∫–æ—Ç–æ—Ä—ã–µ —Å–æ—Ö—Ä–∞–Ω–∏–ª–∏ –∏–º–µ–Ω–∞, –∫–æ—Ç–æ—Ä—ã–µ –º—ã —Ö–æ—Ç–∏–º d, —á—Ç–æ–±—ã –ø–µ—Ä–µ–π—Ç–∏ –≤ —Å–ª–æ–≤–∞—Ä—å.

–ó–∞—Ç–µ–º –º—ã –∏—Å–ø–æ–ª—å–∑–æ–≤–∞–ª–∏ –ø–æ–Ω–∏–º–∞–Ω–∏–µ —Å–ª–æ–≤–∞—Ä—è, —á—Ç–æ–±—ã –ø—Ä–æ—Å–º–æ—Ç—Ä–µ—Ç—å –∫–∞–∂–¥—ã–π —ç–ª–µ–º–µ–Ω—Ç –≤ —Å–ø–∏—Å–∫–µ fruit. –ú—ã –¥–æ–±–∞–≤–ª—è–µ–º —ç–ª–µ–º–µ–Ω—Ç –≤ –Ω–∞—à –Ω–æ–≤—ã–π —Å–ª–æ–≤–∞—Ä—å –¥–ª—è –∫–∞–∂–¥–æ–≥–æ —Ñ—Ä—É–∫—Ç–∞ –≤ –Ω–∞—à–µ–º —Å–ø–∏—Å–∫–µ. –ö–∞–∂–¥–æ–º—É —Ñ—Ä—É–∫—Ç—É –º—ã –ø—Ä–∏—Å–≤–æ–∏–ª–∏ –∑–Ω–∞—á–µ–Ω–∏–µ –í –Ω–∞–ª–∏—á–∏–∏. –ù–∞–∫–æ–Ω–µ—Ü, –º—ã —Ä–∞—Å–ø–µ—á–∞—Ç–∞–ª–∏ –Ω–∞—à –Ω–æ–≤—ã–π —Å–ª–æ–≤–∞—Ä—å –Ω–∞ –∫–æ–Ω—Å–æ–ª—å.

"–ö–∞—Ä—å–µ—Ä–Ω–∞—è –∫–∞—Ä–º–∞ –≤–æ—à–ª–∞ –≤ –º–æ—é –∂–∏–∑–Ω—å, –∫–æ–≥–¥–∞ —è –±–æ–ª—å—à–µ –≤—Å–µ–≥–æ –≤ –Ω–µ–π –Ω—É–∂–¥–∞–ª–∞—Å—å, –∏ –±—ã—Å—Ç—Ä–æ –ø–æ–º–æ–≥–ª–∞ –º–Ω–µ –ø—Ä–æ–π—Ç–∏ –∫—É—Ä—Å –æ–±—É—á–µ–Ω–∏—è. –ß–µ—Ä–µ–∑ –¥–≤–∞ –º–µ—Å—è—Ü–∞ –ø–æ—Å–ª–µ –æ–∫–æ–Ω—á–∞–Ω–∏—è —É—á–µ–±—ã —è –Ω–∞—à–µ–ª —Ä–∞–±–æ—Ç—É —Å–≤–æ–µ–π –º–µ—á—Ç—ã. —Å–æ–æ—Ç–≤–µ—Ç—Å—Ç–≤—É—é—Ç –º–æ–∏–º —Ü–µ–Ω–Ω–æ—Å—Ç—è–º –∏ —Ü–µ–ª—è–º –≤ –∂–∏–∑–Ω–∏! "

–í–µ–Ω–µ—Ä–∞, –∏–Ω–∂–µ–Ω–µ—Ä-–ø—Ä–æ–≥—Ä–∞–º–º–∏—Å—Ç Rockbot

–í –Ω–∞—à–µ–º –ø–æ—Å–ª–µ–¥–Ω–µ–º –ø—Ä–∏–º–µ—Ä–µ –º—ã –ø—Ä–µ–æ–±—Ä–∞–∑–æ–≤–∞–ª–∏ –æ–¥–∏–Ω —Å–ø–∏—Å–æ–∫ –≤ —Å–ª–æ–≤–∞—Ä—å –∏ –ø—Ä–∏—Å–≤–æ–µ–Ω–∏–µ –∑–Ω–∞—á–µ–Ω–∏—è –ø–æ —É–º–æ–ª—á–∞–Ω–∏—é –¥–ª—è –∫–∞–∂–¥–æ–≥–æ —ç–ª–µ–º–µ–Ω—Ç–∞ –≤ —Å–ª–æ–≤–∞—Ä–µ. –û–¥–Ω–∞–∫–æ –º–æ–∂–Ω–æ –ø—Ä–µ–æ–±—Ä–∞–∑–æ–≤–∞—Ç—å –¥–≤–∞ —Å–ø–∏—Å–∫–∞ –≤ —Å–ª–æ–≤–∞—Ä—å.

–î–ª—è —ç—Ç–æ–≥–æ –º—ã –º–æ–∂–µ–º –∏—Å–ø–æ–ª—å–∑–æ–≤–∞—Ç—å Python zip () —Ñ—É–Ω–∫—Ü–∏—è . –≠—Ç–∞ —Ñ—É–Ω–∫—Ü–∏—è –ø–æ–∑–≤–æ–ª—è–µ—Ç –Ω–∞–º –æ–±—ä–µ–¥–∏–Ω–∏—Ç—å –¥–≤–∞ —Å–ø–∏—Å–∫–∞ –≤–º–µ—Å—Ç–µ. –ú—ã –º–æ–∂–µ–º –∏—Å–ø–æ–ª—å–∑–æ–≤–∞—Ç—å –æ–¥–∏–Ω —Å–ø–∏—Å–æ–∫ –≤ –∫–∞—á–µ—Å—Ç–≤–µ –∫–ª—é—á–µ–π –¥–ª—è —Å–ª–æ–≤–∞—Ä—è, –∞ –¥—Ä—É–≥–æ–π - –≤ –∫–∞—á–µ—Å—Ç–≤–µ –∑–Ω–∞—á–µ–Ω–∏–π.

–ü—Ä–µ–¥–ø–æ–ª–æ–∂–∏–º, —É –Ω–∞—Å –µ—Å—Ç—å –¥–≤–∞ —Å–ø–∏—Å–∫–∞: –æ–¥–∏–Ω —Å–æ–¥–µ—Ä–∂–∏—Ç —Å–ø–∏—Å–æ–∫ —Ñ—Ä—É–∫—Ç–æ–≤, –∞ –¥—Ä—É–≥–æ–π - —Ü–µ–Ω—É –∑–∞ –æ—Ç–¥–µ–ª—å–Ω—ã–π —Ñ—Ä—É–∫—Ç. . –ú—ã —Ö–æ—Ç–∏–º —Å–æ–∑–¥–∞—Ç—å –µ–¥–∏–Ω—ã–π —Å–ª–æ–≤–∞—Ä—å, –≤ –∫–æ—Ç–æ—Ä–æ–º –±—É–¥–µ—Ç —Ö—Ä–∞–Ω–∏—Ç—å—Å—è –Ω–∞–∑–≤–∞–Ω–∏–µ —Ñ—Ä—É–∫—Ç–∞ –∏ –µ–≥–æ —Ü–µ–Ω–∞. –ú—ã –º–æ–∂–µ–º –∏—Å–ø–æ–ª—å–∑–æ–≤–∞—Ç—å —Å–ª–µ–¥—É—é—â–∏–π –∫–æ–¥ –¥–ª—è –≤—ã–ø–æ–ª–Ω–µ–Ω–∏—è —ç—Ç–æ–π –∑–∞–¥–∞—á–∏:

–ù–∞—à –∫–æ–¥ –≤–æ–∑–≤—Ä–∞—â–∞–µ—Ç: < / p>

–í–æ-–ø–µ—Ä–≤—ã—Ö, –º—ã —É–∫–∞–∑–∞–ª–∏ –¥–≤–∞ —Å–ø–∏—Å–∫–∞: —Å–ø–∏—Å–æ–∫ —Ñ—Ä—É–∫—Ç–æ–≤ –∏ —Å–ø–∏—Å–æ–∫ —Ü–µ–Ω. –ó–∞—Ç–µ–º –º—ã –∏—Å–ø–æ–ª—å–∑–æ–≤–∞–ª–∏ —Ñ—É–Ω–∫—Ü–∏—é zip (), —á—Ç–æ–±—ã –æ–±—ä–µ–¥–∏–Ω–∏—Ç—å –Ω–∞—à–∏ –¥–≤–∞ —Å–ø–∏—Å–∫–∞ –≤–º–µ—Å—Ç–µ. –§—É–Ω–∫—Ü–∏—è zip () –≤–æ–∑–≤—Ä–∞—â–∞–µ—Ç —Å–ø–∏—Å–æ–∫ –æ–±—ä–µ–¥–∏–Ω–µ–Ω–Ω—ã—Ö –∫–æ—Ä—Ç–µ–∂–µ–π. –ü–æ—Å–∫–æ–ª—å–∫—É –Ω–∞–º –Ω—É–∂–µ–Ω —Å–ª–æ–≤–∞—Ä—å, –º—ã –∏—Å–ø–æ–ª—å–∑–æ–≤–∞–ª–∏ dict () –¥–ª—è –ø—Ä–µ–æ–±—Ä–∞–∑–æ–≤–∞–Ω–∏—è –Ω–∞—à–∏—Ö –∫–æ—Ä—Ç–µ–∂–µ–π –≤ —Å–ª–æ–≤–∞—Ä—å.

–ó–∞—Ç–µ–º –º—ã –≤—ã–≤–µ–ª–∏ —Å–æ–¥–µ—Ä–∂–∏–º–æ–µ –Ω–∞—à–µ–≥–æ –Ω–æ–≤–æ–≥–æ —Å–ª–æ–≤–∞—Ä—è –Ω–∞ –∫–æ–Ω—Å–æ–ª—å.

–ó–∞–∫–ª—é—á–µ–Ω–∏–µ

–ß—Ç–æ–±—ã –ø—Ä–µ–æ–±—Ä–∞–∑–æ–≤–∞—Ç—å —Å–ø–∏—Å–æ–∫ –≤ —Å–ª–æ–≤–∞—Ä—å —Å –∏—Å–ø–æ–ª—å–∑–æ–≤–∞–Ω–∏–µ–º —Ç–µ—Ö –∂–µ –∑–Ω–∞—á–µ–Ω–∏–π, –≤—ã –º–æ–∂–Ω–æ –∏—Å–ø–æ–ª—å–∑–æ–≤–∞—Ç—å –º–µ—Ç–æ–¥ dict.fromkeys (). –ß—Ç–æ–±—ã –ø—Ä–µ–æ–±—Ä–∞–∑–æ–≤–∞—Ç—å –¥–≤–∞ —Å–ø–∏—Å–∫–∞ –≤ –æ–¥–∏–Ω —Å–ª–æ–≤–∞—Ä—å, –≤—ã –º–æ–∂–µ—Ç–µ –∏—Å–ø–æ–ª—å–∑–æ–≤–∞—Ç—å —Ñ—É–Ω–∫—Ü–∏—é Python zip (). –ü–æ–Ω–∏–º–∞–Ω–∏–µ —Å–ª–æ–≤–∞—Ä—è –ø–æ–∑–≤–æ–ª—è–µ—Ç –≤–∞–º —Å–æ–∑–¥–∞—Ç—å –Ω–æ–≤—ã–π —Å–ª–æ–≤–∞—Ä—å –Ω–∞ –æ—Å–Ω–æ–≤–µ –∑–Ω–∞—á–µ–Ω–∏–π —Å–ø–∏—Å–∫–∞.

–í —ç—Ç–æ–º —Ä—É–∫–æ–≤–æ–¥—Å—Ç–≤–µ –º—ã –∏—Å–ø–æ–ª—å–∑–æ–≤–∞–ª–∏ –ø—Ä–∏–º–µ—Ä—ã, —á—Ç–æ–±—ã –ø—Ä–æ–¥–µ–º–æ–Ω—Å—Ç—Ä–∏—Ä–æ–≤–∞—Ç—å, –∫–∞–∫ –∏—Å–ø–æ–ª—å–∑–æ–≤–∞—Ç—å —Ç—Ä–∏ –ø–æ–¥—Ö–æ–¥–∞ –¥–ª—è –ø—Ä–µ–æ–±—Ä–∞–∑–æ–≤–∞–Ω–∏—è —Å–ø–∏—Å–∫–∞ –≤ —Å–ª–æ–≤–∞—Ä—å –≤ Python. –¢–µ–ø–µ—Ä—å –≤—ã –≥–æ—Ç–æ–≤—ã –Ω–∞—á–∞—Ç—å –ø—Ä–µ–æ–±—Ä–∞–∑–æ–≤–∞–Ω–∏–µ —Å–ø–∏—Å–∫–æ–≤ Python –≤ —Å–ª–æ–≤–∞—Ä–∏, –∫–∞–∫ –ø—Ä–æ—Ñ–µ—Å—Å–∏–æ–Ω–∞–ª—å–Ω—ã–π –ø—Ä–æ–≥—Ä–∞–º–º–∏—Å—Ç!

–•–æ—Ç–∏—Ç–µ —É–∑–Ω–∞—Ç—å –±–æ–ª—å—à–µ –æ Python? –ü—Ä–æ—á—Ç–∏—Ç–µ –Ω–∞—à–µ —Ä—É–∫–æ–≤–æ–¥—Å—Ç–≤–æ –ø–æ –∏–∑—É—á–µ–Ω–∏—é Python . –≠—Ç–æ —Ä—É–∫–æ–≤–æ–¥—Å—Ç–≤–æ —Å–æ–¥–µ—Ä–∂–∏—Ç —Å–ø–∏—Å–æ–∫ –æ–Ω–ª–∞–π–Ω-–∫—É—Ä—Å–æ–≤, –∫–Ω–∏–≥ –∏ —É—á–µ–±–Ω—ã—Ö —Ä–µ—Å—É—Ä—Å–æ–≤, –∫–æ—Ç–æ—Ä—ã–µ –≤—ã –º–æ–∂–µ—Ç–µ –∏—Å–ø–æ–ª—å–∑–æ–≤–∞—Ç—å, —á—Ç–æ–±—ã —Ä–∞—Å—à–∏—Ä–∏—Ç—å —Å–≤–æ–∏ –∑–Ω–∞–Ω–∏—è. –∫–æ–¥–∏—Ä–æ–≤–∞–Ω–∏—è –Ω–∞ Python.