Как написать генератор Python

–ò—Ç–µ—Ä–∞—Ç–æ—Ä—ã –∏–≥—Ä–∞—é—Ç –≤–∞–∂–Ω—É—é —Ä–æ–ª—å –≤ Python. –û–Ω–∏ –ø–æ–∑–≤–æ–ª—è—é—Ç –≤–∞–º —Å–æ–∑–¥–∞—Ç—å –æ–±—ä–µ–∫—Ç, –∫–æ—Ç–æ—Ä—ã–π –º–æ–∂–Ω–æ –ø–æ–≤—Ç–æ—Ä—è—Ç—å. –≠—Ç–æ —Ö–æ—Ä–æ—à–∏–π —Å–ø–æ—Å–æ–± —Ö—Ä–∞–Ω–µ–Ω–∏—è –¥–∞–Ω–Ω—ã—Ö, –∫ –∫–æ—Ç–æ—Ä—ã–º –º–æ–∂–Ω–æ –ø–æ–ª—É—á–∏—Ç—å –¥–æ—Å—Ç—É–ø —Å –ø–æ–º–æ—â—å—é —Ü–∏–∫–ª–∞ for in.

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

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

–ë–µ–∑ –ª–∏—à–Ω–∏—Ö —Å–ª–æ–≤, –¥–∞–≤–∞–π—Ç–µ –Ω–∞—á–Ω–µ–º!

–ß—Ç–æ —Ç–∞–∫–æ–µ –≥–µ–Ω–µ—Ä–∞—Ç–æ—Ä? < / h2>

–ì–µ–Ω–µ—Ä–∞—Ç–æ—Ä - —ç—Ç–æ –ø—Ä–æ—Å—Ç–æ–π —Å–ø–æ—Å–æ–± —Å–æ–∑–¥–∞–Ω–∏—è –∏—Ç–µ—Ä–∞—Ç–æ—Ä–∞ –≤ Python. –≠—Ç–æ —Ñ—É–Ω–∫—Ü–∏—è, –≤–æ–∑–≤—Ä–∞—â–∞—é—â–∞—è –æ–±—ä–µ–∫—Ç, –ø–æ –∫–æ—Ç–æ—Ä–æ–º—É –º–æ–∂–Ω–æ –≤—ã–ø–æ–ª–Ω—è—Ç—å –∏—Ç–µ—Ä–∞—Ü–∏—é.

–ì–µ–Ω–µ—Ä–∞—Ç–æ—Ä—ã —á–∞—Å—Ç–æ –Ω–∞–∑—ã–≤–∞—é—Ç —Å–∏–Ω—Ç–∞–∫—Å–∏—á–µ—Å–∫–∏–º —Å–∞—Ö–∞—Ä–æ–º. –≠—Ç–æ –ø–æ—Ç–æ–º—É, —á—Ç–æ –æ–Ω–∏ –Ω–µ –æ–±—è–∑–∞—Ç–µ–ª—å–Ω–æ –¥–æ–±–∞–≤–ª—è—é—Ç –Ω–æ–≤—ã–µ —Ñ—É–Ω–∫—Ü–∏–∏ –≤ Python. –û–Ω–∏ –ø–æ–º–æ–≥–∞—é—Ç —Å–¥–µ–ª–∞—Ç—å –≤–∞—à –∫–æ–¥ –±–æ–ª–µ–µ —ç—Ñ—Ñ–µ–∫—Ç–∏–≤–Ω—ã–º.

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

–î–∞–≤–∞–π—Ç–µ –≤–∑–≥–ª—è–Ω–µ–º –Ω–∞ –∏—Ç–µ—Ä–∞—Ç–æ—Ä Python:

< p> 81% —É—á–∞—Å—Ç–Ω–∏–∫–æ–≤ –∑–∞—è–≤–∏–ª–∏, —á—Ç–æ –ø–æ—Å–ª–µ –±—É—Ç–∫–µ–º–ø–∞ –æ–Ω–∏ –ø–æ—á—É–≤—Å—Ç–≤–æ–≤–∞–ª–∏ —Å–µ–±—è –±–æ–ª–µ–µ —É–≤–µ—Ä–µ–Ω–Ω—ã–º–∏ –≤ —Å–≤–æ–∏—Ö –ø–µ—Ä—Å–ø–µ–∫—Ç–∏–≤–∞—Ö —Ç—Ä—É–¥–æ—É—Å—Ç—Ä–æ–π—Å—Ç–≤–∞ –≤ —Å—Ñ–µ—Ä–µ –≤—ã—Å–æ–∫–∏—Ö —Ç–µ—Ö–Ω–æ–ª–æ–≥–∏–π. –ù–∞–π–¥–∏—Ç–µ –ø–æ–¥—Ö–æ–¥ –∫ —É—á–µ–±–Ω–æ–º—É –ª–∞–≥–µ—Ä—é —Å–µ–≥–æ–¥–Ω—è.

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

–≠—Ç–æ—Ç –∫–æ–¥ —Å–æ–∑–¥–∞–µ—Ç –∏—Ç–µ—Ä–∞—Ç–æ—Ä, –Ω–∞–∑—ã–≤–∞–µ–º—ã–π –ü–µ—á–µ–Ω—å–µ. –ö–æ–≥–¥–∞ –≤—ã –ø–µ—Ä–µ–¥–∞–µ—Ç–µ –¥–∞–Ω–Ω—ã–µ —á–µ—Ä–µ–∑ —ç—Ç–æ—Ç –∏—Ç–µ—Ä–∞—Ç–æ—Ä, –æ–Ω–∏ –ø—Ä–µ–≤—Ä–∞—â–∞—é—Ç—Å—è –≤ –ø–æ–≤—Ç–æ—Ä—è–µ–º—ã–π –æ–±—ä–µ–∫—Ç. –≠—Ç–æ –æ–∑–Ω–∞—á–∞–µ—Ç, —á—Ç–æ –≤—ã –º–æ–∂–µ—Ç–µ –ø–µ—Ä–µ–±–∏—Ä–∞—Ç—å –¥–∞–Ω–Ω—ã–µ, –∏—Å–ø–æ–ª—å–∑—É—è —Ü–∏–∫–ª for in. –ï—Å–ª–∏ –≤—ã —Å–º–æ—Ç—Ä–∏—Ç–µ –Ω–∞ —ç—Ç–æ—Ç –∫–æ–¥ –∏ –¥—É–º–∞–µ—Ç–µ, —á—Ç–æ –æ–Ω –¥–µ–π—Å—Ç–≤–∏—Ç–µ–ª—å–Ω–æ –¥–ª–∏–Ω–Ω—ã–π, —Ç–æ —ç—Ç–æ –ø–æ—Ç–æ–º—É, —á—Ç–æ —ç—Ç–æ —Ç–∞–∫.

–ì–µ–Ω–µ—Ä–∞—Ç–æ—Ä—ã –º–æ–≥—É—Ç –ø–æ–º–æ—á—å –Ω–∞–º —Å–æ–∫—Ä–∞—Ç–∏—Ç—å —ç—Ç–æ—Ç –∫–æ–¥. –î–∞–≤–∞–π—Ç–µ –Ω–∞–ø–∏—à–µ–º –≥–µ–Ω–µ—Ä–∞—Ç–æ—Ä –¥–ª—è –Ω–∞—à–µ–≥–æ –≤—ã—à–µ—É–ø–æ–º—è–Ω—É—Ç–æ–≥–æ –∏—Ç–µ—Ä–∞—Ç–æ—Ä–∞:

–†–∞–∑–º–µ—Ä –Ω–∞—à–µ–≥–æ –∫–æ–¥–∞ –∑–Ω–∞—á–∏—Ç–µ–ª—å–Ω–æ —É–º–µ–Ω—å—à–µ–Ω. –î–∞–≤–∞–π—Ç–µ –æ–±—Å—É–¥–∏–º, –∫–∞–∫ —ç—Ç–æ —Ä–∞–±–æ—Ç–∞–µ—Ç.

–ì–µ–Ω–µ—Ä–∞—Ç–æ—Ä - —ç—Ç–æ —Ñ—É–Ω–∫—Ü–∏—è, –∫–æ—Ç–æ—Ä–∞—è –∏–º–µ–µ—Ç –∫–ª—é—á–µ–≤–æ–µ —Å–ª–æ–≤–æ yield –≤–º–µ—Å—Ç–æ –æ–ø–µ—Ä–∞—Ç–æ—Ä–∞ return. –û–ø–µ—Ä–∞—Ç–æ—Ä—ã Yield –≤–æ–∑–≤—Ä–∞—â–∞—é—Ç –∑–Ω–∞—á–µ–Ω–∏–µ –∏–∑ —Ñ—É–Ω–∫—Ü–∏–∏.

–†–∞–∑–Ω–∏—Ü–∞ –º–µ–∂–¥—É –æ–ø–µ—Ä–∞—Ç–æ—Ä–æ–º yield –∏ –æ–ø–µ—Ä–∞—Ç–æ—Ä–æ–º return –∑–∞–∫–ª—é—á–∞–µ—Ç—Å—è –≤ —Ç–æ–º, —á—Ç–æ –æ–ø–µ—Ä–∞—Ç–æ—Ä return –æ—Å—Ç–∞–Ω–∞–≤–ª–∏–≤–∞–µ—Ç –≤—ã–ø–æ–ª–Ω–µ–Ω–∏–µ —Ñ—É–Ω–∫—Ü–∏–∏, —Ç–æ–≥–¥–∞ –∫–∞–∫ –æ–ø–µ—Ä–∞—Ç–æ—Ä yield –ø—Ä–∏–æ—Å—Ç–∞–Ω–∞–≤–ª–∏–≤–∞–µ—Ç –≤—ã–ø–æ–ª–Ω–µ–Ω–∏–µ —Ñ—É–Ω–∫—Ü–∏–∏ –∏ –ø—Ä–æ–¥–æ–ª–∂–∞–µ—Ç –∏—Ç–µ—Ä–∞—Ü–∏—è.

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

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

Raspberry

< p> Raspberry

& hellip;

–≠—Ç–æ—Ç –∫–æ–¥ –ø–æ–≤—Ç–æ—Ä—è–µ—Ç—Å—è –¥–æ —Ç–µ—Ö –ø–æ—Ä, –ø–æ–∫–∞ –º—ã –Ω–µ –æ—Å—Ç–∞–Ω–æ–≤–∏–º –Ω–∞—à—É –ø—Ä–æ–≥—Ä–∞–º–º—É. –≠—Ç–æ –ø–æ—Ç–æ–º—É, —á—Ç–æ –º—ã –∏—Å–ø–æ–ª—å–∑–æ–≤–∞–ª–∏ —Ü–∏–∫–ª while, –∫–æ—Ç–æ—Ä—ã–π –≤—ã–ø–æ–ª–Ω—è–µ—Ç—Å—è –Ω–∞–≤—Å–µ–≥–¥–∞. –í –±–æ–ª—å—à–∏–Ω—Å—Ç–≤–µ —Å–ª—É—á–∞–µ–≤ —ç—Ç–æ –Ω–µ –æ—á–µ–Ω—å –ø–æ–ª–µ–∑–Ω–æ. –î–∞–≤–∞–π—Ç–µ –Ω–∞–ø–∏—à–µ–º –≥–µ–Ω–µ—Ä–∞—Ç–æ—Ä, –∫–æ—Ç–æ—Ä—ã–π –æ—Å—Ç–∞–Ω–∞–≤–ª–∏–≤–∞–µ—Ç—Å—è –ø—Ä–∏ –≤—ã–ø–æ–ª–Ω–µ–Ω–∏–∏ –¥–µ–π—Å—Ç–≤–∏—è.

–ö–∞–∫ –Ω–∞–ø–∏—Å–∞—Ç—å –≥–µ–Ω–µ—Ä–∞—Ç–æ—Ä Python

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

[" Raspberry & rdquo ;, " Choc-Chip & rdquo ;, " Cinnamon " & ldquo ; Oat "]

–ß—Ç–æ–±—ã —Ä–∞—Å–ø–µ—á–∞—Ç–∞—Ç—å –∏—Ö –Ω–∞ –∫–æ–Ω—Å–æ–ª–∏, –º—ã –º–æ–≥–ª–∏ –±—ã —Å–æ–∑–¥–∞—Ç—å –µ–ª –ø—Ä–æ—Å—Ç–æ–π –≥–µ–Ω–µ—Ä–∞—Ç–æ—Ä. –û—Ç–∫—Ä–æ–π—Ç–µ –Ω–æ–≤—ã–π —Ñ–∞–π–ª Python –∏ –≤—Å—Ç–∞–≤—å—Ç–µ —Å–ª–µ–¥—É—é—â–∏–π –∫–æ–¥:

–ù–∞—à –≥–µ–Ω–µ—Ä–∞—Ç–æ—Ä –ø—Ä–æ—Å–º–∞—Ç—Ä–∏–≤–∞–µ—Ç –≤—Å–µ cookie –≤ —É–∫–∞–∑–∞–Ω–Ω–æ–º –Ω–∞–º–∏ —Å–ø–∏—Å–∫–µ –∏ –≤–æ–∑–≤—Ä–∞—â–∞–µ—Ç –∫–∞–∂–¥—ã–π cookie –∏–Ω–¥–∏–≤–∏–¥—É–∞–ª—å–Ω–æ. –≠—Ç–æ—Ç –≥–µ–Ω–µ—Ä–∞—Ç–æ—Ä –ø–æ–∫–∞ –Ω–µ —Ä–∞–±–æ—Ç–∞–µ—Ç. –ú—ã –¥–æ–ª–∂–Ω—ã –∏—Å–ø–æ–ª—å–∑–æ–≤–∞—Ç—å —Ü–∏–∫–ª for, —á—Ç–æ–±—ã –ø–µ—Ä–µ–±—Ä–∞—Ç—å –µ–≥–æ:

–ú—ã –æ–ø—Ä–µ–¥–µ–ª–∏–ª–∏ –º–∞—Å—Å–∏–≤ –ø–æ–¥ –Ω–∞–∑–≤–∞–Ω–∏–µ–º cookie_list, –≤ –∫–æ—Ç–æ—Ä–æ–º —Ö—Ä–∞–Ω–∏—Ç—Å—è —Å–ø–∏—Å–æ–∫ –∏–∑ —á–µ—Ç—ã—Ä–µ—Ö —Ñ–∞–π–ª–æ–≤ cookie. –ó–∞—Ç–µ–º –º—ã –Ω–∞—Å—Ç—Ä–æ–∏–ª–∏ —Ü–∏–∫–ª for, –∫–æ—Ç–æ—Ä—ã–π –∏—Å–ø–æ–ª—å–∑—É–µ—Ç –Ω–∞—à –≥–µ–Ω–µ—Ä–∞—Ç–æ—Ä –¥–ª—è –ø–µ—Ä–µ–±–æ—Ä–∞ –∑–Ω–∞—á–µ–Ω–∏–π –≤ cookie_list.

–î–ª—è –∫–∞–∂–¥–æ–π –∏—Ç–µ—Ä–∞—Ü–∏–∏ –≤ –Ω–∞—à–µ–º —Ü–∏–∫–ª–µ for –Ω–∞–ø–µ—á–∞—Ç–∞–Ω —Å–≥–µ–Ω–µ—Ä–∏—Ä–æ–≤–∞–Ω–Ω—ã–π –æ–±—ä–µ–∫—Ç –Ω–∞ –∫–æ–Ω—Å–æ–ª—å:

Raspberry

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

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

Choc-Chip

–ö–æ—Ä–∏—Ü–∞

–û–≤—Å—è–Ω–∫–∞

–ú—ã —Å–¥–µ–ª–∞–ª–∏ —ç—Ç–æ! –≠—Ç–æ—Ç –≥–µ–Ω–µ—Ä–∞—Ç–æ—Ä –≤–æ–∑–≤—Ä–∞—â–∞–µ—Ç –∑–Ω–∞—á–µ–Ω–∏—è –¥–æ —Ç–µ—Ö –ø–æ—Ä, –ø–æ–∫–∞ –∫–∞–∂–¥–æ–µ –∑–Ω–∞—á–µ–Ω–∏–µ –≤ –ø–µ—Ä–µ–º–µ–Ω–Ω–æ–π cookie_list –Ω–µ –±—É–¥–µ—Ç –ø–æ–≤—Ç–æ—Ä–µ–Ω–æ.

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

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

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

2,3

4,8

6,75

12,75

20,25

22.4

–ù–∞—à –≥–µ–Ω–µ—Ä–∞—Ç–æ—Ä —Ä–∞—Å—Å—á–∏—Ç–∞–ª —Å–æ–≤–æ–∫—É–ø–Ω–æ–µ –∑–Ω–∞—á–µ–Ω–∏–µ –≤—Å–µ—Ö –∑–∞–∫–∞–∑–æ–≤ –≤ –ø–µ—Ä–µ–º–µ–Ω–Ω–æ–π order_list. –ö–∞–∂–¥–∞—è –∏—Ç–µ—Ä–∞—Ü–∏—è –ø–æ —Å–ø–∏—Å–∫—É –≤–æ–∑–≤—Ä–∞—â–∞–µ—Ç –Ω–æ–≤–æ–µ —Å–æ–≤–æ–∫—É–ø–Ω–æ–µ –∑–Ω–∞—á–µ–Ω–∏–µ.

–ö–∞–∫ —Å–¥–µ–ª–∞—Ç—å –ù–∞–ø–∏—à–∏—Ç–µ –≤—ã—Ä–∞–∂–µ–Ω–∏–µ –≥–µ–Ω–µ—Ä–∞—Ç–æ—Ä–∞

–ì–µ–Ω–µ—Ä–∞—Ç–æ—Ä—ã —É–∂–µ –ø—Ä–æ—â–µ –ø–∏—Å–∞—Ç—å, —á–µ–º –∏—Ç–µ—Ä–∞—Ç–æ—Ä—ã. –ù–∞—à–µ —Å—Ç—Ä–µ–º–ª–µ–Ω–∏–µ –∫ –Ω–∞–ø–∏—Å–∞–Ω–∏—é –±–æ–ª–µ–µ —á–∏—Å—Ç–æ–≥–æ –∫–æ–¥–∞ –Ω–µ –¥–æ–ª–∂–Ω–æ –ø—Ä–µ–∫—Ä–∞—â–∞—Ç—å—Å—è –±–ª–∞–≥–æ–¥–∞—Ä—è –≤—ã—Ä–∞–∂–µ–Ω–∏—è–º –≥–µ–Ω–µ—Ä–∞—Ç–æ—Ä–∞.

–í—ã—Ä–∞–∂–µ–Ω–∏—è –≥–µ–Ω–µ—Ä–∞—Ç–æ—Ä–∞ –ø–æ—Ö–æ–∂–∏ –Ω–∞ –ø–æ–Ω–∏–º–∞–Ω–∏–µ —Å–ø–∏—Å–∫–æ–≤ . –í—ã—Ä–∞–∂–µ–Ω–∏—è –≥–µ–Ω–µ—Ä–∞—Ç–æ—Ä–∞ —Å–æ–∑–¥–∞—é—Ç –æ–¥–∏–Ω —ç–ª–µ–º–µ–Ω—Ç –∑–∞ —Ä–∞–∑, –∫–∞–∫ –≥–µ–Ω–µ—Ä–∞—Ç–æ—Ä. –≠—Ç–æ –æ—Ç–ª–∏—á–∞–µ—Ç—Å—è –æ—Ç –ø–æ–Ω–∏–º–∞–Ω–∏—è —Å–ø–∏—Å–∫–∞, –∫–æ—Ç–æ—Ä–æ–µ —Å–æ–∑–¥–∞–µ—Ç –≤–µ—Å—å —Å–ø–∏—Å–æ–∫, –≤—Å–µ –æ–¥–Ω–æ–≤—Ä–µ–º–µ–Ω–Ω–æ.

–î–∞–≤–∞–π—Ç–µ –Ω–∞–ø–∏—à–µ–º –≥–µ–Ω–µ—Ä–∞—Ç–æ—Ä –¥–ª—è –Ω–∞—à–µ–≥–æ –ø—Ä–∏–º–µ—Ä–∞ —Ñ–∞–π–ª–æ–≤ cookie:

–ú—ã " ve –æ–ø—Ä–µ–¥–µ–ª–∏–ª —Å–ø–∏—Å–æ–∫ —Ñ–∞–π–ª–æ–≤ cookie –≤ –ø–µ—Ä–µ–º–µ–Ω–Ω–æ–π cookie_list. –ó–∞—Ç–µ–º –º—ã —Å–æ–∑–¥–∞–µ–º –≤—ã—Ä–∞–∂–µ–Ω–∏–µ –≥–µ–Ω–µ—Ä–∞—Ç–æ—Ä–∞. –í —ç—Ç–æ–º –≤—ã—Ä–∞–∂–µ–Ω–∏–∏ –∏—Å–ø–æ–ª—å–∑—É–µ—Ç—Å—è —Å–∏–Ω—Ç–∞–∫—Å–∏—Å –¥–ª—è —Å–æ—Å—Ç–∞–≤–ª–µ–Ω–∏—è —Å–ø–∏—Å–∫–æ–≤, –Ω–æ —Å –æ–¥–Ω–∏–º –±–æ–ª—å—à–∏–º –æ—Ç–ª–∏—á–∏–µ–º: —Å–æ—Å—Ç–∞–≤–ª–µ–Ω–∏–µ —Å–ø–∏—Å–∫–æ–≤ –æ–ø—Ä–µ–¥–µ–ª—è–µ—Ç—Å—è –≤ –∫–≤–∞–¥—Ä–∞—Ç–Ω—ã—Ö —Å–∫–æ–±–∫–∞—Ö, –∞ –≥–µ–Ω–µ—Ä–∞—Ç–æ—Ä—ã - –≤ —Å–∫–æ–±–∫–∞—Ö —Å –∑–∞–∫—Ä—É–≥–ª–µ–Ω–Ω—ã–º–∏ —É–≥–ª–∞–º–∏.

–î–∞–≤–∞–π—Ç–µ —Å–æ–∑–¥–∞–¥–∏–º —Ü–∏–∫–ª for, –∫–æ—Ç–æ—Ä—ã–π –ø–æ–≤—Ç–æ—Ä—è–µ—Ç—Å—è –≤—ã—Ä–∞–∂–µ–Ω–∏–µ:

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

Raspberry

Choc-Chip

–ö–æ—Ä–∏—Ü–∞

–û–≤–µ—Å

–û—Ç–≤–µ—Ç —ç—Ç–æ–≥–æ –≥–µ–Ω–µ—Ä–∞—Ç–æ—Ä–∞ —Ç–∞–∫–æ–π –∂–µ, –∫–∞–∫ –∏ –≤ –Ω–∞—à–µ–º –ø–µ—Ä–≤–æ–º –ø—Ä–∏–º–µ—Ä–µ. –ù–∞—à —Å–∏–Ω—Ç–∞–∫—Å–∏—Å –∑–Ω–∞—á–∏—Ç–µ–ª—å–Ω–æ —è—Å–Ω–µ–µ.

–í–∞–∂–Ω–æ –æ—Ç–º–µ—Ç–∏—Ç—å, —á—Ç–æ –∫–æ–≥–¥–∞ –≤—ã –ø–µ—Ä–µ–±–∏—Ä–∞–µ—Ç–µ –≥–µ–Ω–µ—Ä–∞—Ç–æ—Ä, –∫–æ—Ç–æ—Ä—ã–π –±—ã–ª –æ–±—ä—è–≤–ª–µ–Ω —Å –∏—Å–ø–æ–ª—å–∑–æ–≤–∞–Ω–∏–µ–º –≤—ã—Ä–∞–∂–µ–Ω–∏—è –≥–µ–Ω–µ—Ä–∞—Ç–æ—Ä–∞, –≤—ã –Ω–µ –≤—ã–∑—ã–≤–∞–µ—Ç–µ –µ–≥–æ –∫–∞–∫ —Ñ—É–Ω–∫—Ü–∏—é. –ù–∞—à –≥–µ–Ω–µ—Ä–∞—Ç–æ—Ä cookie_generator –Ω–µ –ø—Ä–∏–Ω–∏–º–∞–µ—Ç –Ω–∏–∫–∞–∫–∏—Ö –≤—Ö–æ–¥–Ω—ã—Ö –∑–Ω–∞—á–µ–Ω–∏–π: –æ–Ω —É–∂–µ —Å–æ–¥–µ—Ä–∂–∏—Ç –∫–æ–¥, –Ω–µ–æ–±—Ö–æ–¥–∏–º—ã–π –¥–ª—è –ø–µ—Ä–µ–±–æ—Ä–∞ —Å–ø–∏—Å–∫–∞ cookie_list.

–í–∞–º —Å–ª–µ–¥—É–µ—Ç –ò—Å–ø–æ–ª—å–∑—É–π—Ç–µ —Å–∏–Ω—Ç–∞–∫—Å–∏—Å –≤—ã—Ä–∞–∂–µ–Ω–∏–π –≥–µ–Ω–µ—Ä–∞—Ç–æ—Ä–∞ —Ç–æ–ª—å–∫–æ —Ç–æ–≥–¥–∞, –∫–æ–≥–¥–∞ –≤–∞–º –Ω—É–∂–Ω–æ –Ω–∞–ø–∏—Å–∞—Ç—å –≥–µ–Ω–µ—Ä–∞—Ç–æ—Ä, –≤—ã–ø–æ–ª–Ω—è—é—â–∏–π –ø—Ä–æ—Å—Ç—É—é —Ñ—É–Ω–∫—Ü–∏—é. –•–æ—Ä–æ—à–∏–º –ø—Ä–∏–º–µ—Ä–æ–º —è–≤–ª—è–µ—Ç—Å—è –ø–µ—á–∞—Ç—å —Å–ø–∏—Å–∫–∞ –∑–Ω–∞—á–µ–Ω–∏–π; –£–º–Ω–æ–∂–µ–Ω–∏–µ –∑–Ω–∞—á–µ–Ω–∏–π –≤ —Å–ø–∏—Å–∫–µ –Ω–∞ –æ–ø—Ä–µ–¥–µ–ª–µ–Ω–Ω–æ–µ —á–∏—Å–ª–æ - –µ—â–µ –æ–¥–∏–Ω —Ö–æ—Ä–æ—à–∏–π –ø—Ä–∏–º–µ—Ä.

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

–ü–æ—á–µ–º—É –∏—Å–ø–æ–ª—å–∑—É—é—Ç—Å—è –≥–µ–Ω–µ—Ä–∞—Ç–æ—Ä—ã?

–û—Å–Ω–æ–≤–Ω–∞—è –ø—Ä–∏—á–∏–Ω–∞ –∏—Å–ø–æ–ª—å–∑–æ–≤–∞–Ω–∏—è –≥–µ–Ω–µ—Ä–∞—Ç–æ—Ä–æ–≤ –∑–∞–∫–ª—é—á–∞–µ—Ç—Å—è –≤ —Ç–æ–º, —á—Ç–æ –æ–Ω–∏ –±–æ–ª–µ–µ –∫—Ä–∞—Ç–∫–∏–µ, —á–µ–º –∏—Ç–µ—Ä–∞—Ç–æ—Ä—ã.

–ì–µ–Ω–µ—Ä–∞—Ç–æ—Ä—ã –ø–æ—Ö–æ–∂–∏ –Ω–∞ —Ñ—É–Ω–∫—Ü–∏—é –∏ –Ω–µ –Ω—É–∂–Ω—ã –¥–ª—è —Ä–∞–±–æ—Ç—ã –∫–∞–∫–∏–µ-–ª–∏–±–æ –æ–ø–µ—Ä–∞—Ç–æ—Ä—ã __init__, __iter__ –∏–ª–∏ __next__. –≠—Ç–æ –Ω–µ –ø–æ—Ö–æ–∂–µ –Ω–∞ –∏—Ç–µ—Ä–∞—Ç–æ—Ä, –∫–æ—Ç–æ—Ä—ã–π —Ç—Ä–µ–±—É–µ—Ç –≤—Å–µ—Ö —Ç—Ä–µ—Ö —ç—Ç–∏—Ö –æ–ø–µ—Ä–∞—Ç–æ—Ä–æ–≤. –¢–∞–∫–æ–µ –ø–æ–≤–µ–¥–µ–Ω–∏–µ –æ–∑–Ω–∞—á–∞–µ—Ç, —á—Ç–æ –≤—ã –º–æ–∂–µ—Ç–µ —Ä–µ–∞–ª–∏–∑–æ–≤–∞—Ç—å –≥–µ–Ω–µ—Ä–∞—Ç–æ—Ä –≤ –∑–Ω–∞—á–∏—Ç–µ–ª—å–Ω–æ –º–µ–Ω—å—à–µ–º –∫–æ–ª–∏—á–µ—Å—Ç–≤–µ —Å—Ç—Ä–æ–∫ –∫–æ–¥–∞, —á–µ–º –µ—Å–ª–∏ –±—ã –≤—ã –ø–∏—Å–∞–ª–∏ –∏—Ç–µ—Ä–∞—Ç–æ—Ä.

–ë–æ–ª–µ–µ —Ç–æ–≥–æ, –≥–µ–Ω–µ—Ä–∞—Ç–æ—Ä—ã —ç—Ñ—Ñ–µ–∫—Ç–∏–≤–Ω–æ –∏—Å–ø–æ–ª—å–∑—É—é—Ç –ø–∞–º—è—Ç—å. –ì–µ–Ω–µ—Ä–∞—Ç–æ—Ä—ã —Å–æ–∑–¥–∞—é—Ç —Ç–æ–ª—å–∫–æ –æ–¥–∏–Ω —ç–ª–µ–º–µ–Ω—Ç –∑–∞ —Ä–∞–∑. –û–Ω–∏ –Ω–µ —Å–æ–∑–¥–∞—é—Ç –≤—Å—é –ø–æ—Å–ª–µ–¥–æ–≤–∞—Ç–µ–ª—å–Ω–æ—Å—Ç—å –≤ –ø–∞–º—è—Ç–∏ –ø–µ—Ä–µ–¥ –≤–æ–∑–≤—Ä–∞—Ç–æ–º —Ä–µ–∑—É–ª—å—Ç–∞—Ç–∞. –≠—Ç–æ –∑–∞—Å—Ç–∞–≤–ª—è–µ—Ç –≥–µ–Ω–µ—Ä–∞—Ç–æ—Ä—ã –æ—á–µ–Ω—å –ø—Ä–∞–∫—Ç–∏—á–Ω—ã, –µ—Å–ª–∏ –≤–∞–º –Ω—É–∂–Ω–æ –ø–µ—Ä–µ–±—Ä–∞—Ç—å –±–æ–ª—å—à–æ–π —Å–ø–∏—Å–æ–∫ –¥–∞–Ω–Ω—ã—Ö.

–≠—Ç–æ —Ä–∞–±–æ—Ç–∞–µ—Ç —Ç–∞–∫: –∏—Ç–µ—Ä–∞—Ç–æ—Ä—ã –∏—Å–ø–æ–ª—å–∑—É—é—Ç –ª–µ–Ω–∏–≤—ã–π –º–µ—Ç–æ–¥ –æ—Ü–µ–Ω–∫–∏. –û–Ω–∏ –≥–µ–Ω–µ—Ä–∏—Ä—É—é—Ç —Ç–æ–ª—å–∫–æ —Å–ª–µ–¥—É—é—â–∏–π —ç–ª–µ–º–µ–Ω—Ç –∏—Ç–µ—Ä–∏—Ä—É–µ–º–æ–≥–æ –æ–±—ä–µ–∫—Ç–∞ ct, –∫–æ–≥–¥–∞ —ç—Ç–æ—Ç —ç–ª–µ–º–µ–Ω—Ç –∑–∞–ø—Ä–∞—à–∏–≤–∞–µ—Ç—Å—è.

–ó–∞–∫–ª—é—á–µ–Ω–∏–µ (–∏ –ø—Ä–æ–±–ª–µ–º–∞)

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

–ì–µ–Ω–µ—Ä–∞—Ç–æ—Ä—ã —É–ø—Ä–æ—â–∞—é—Ç –∑–∞–¥–∞—á—É –¥–ª—è –∑–∞–ø–∏—Å–∏ –æ–±—ä–µ–∫—Ç–æ–≤ —Å –∏—Å–ø–æ–ª—å–∑–æ–≤–∞–Ω–∏–µ–º –ø—Ä–æ—Ç–æ–∫–æ–ª–∞ –∏—Ç–µ—Ä–∞—Ç–æ—Ä–∞ –±–µ–∑ –Ω–µ–æ–±—Ö–æ–¥–∏–º–æ—Å—Ç–∏ –ø–∏—Å–∞—Ç—å –æ–ø–µ—Ä–∞—Ç–æ—Ä—ã __init__, __iter__ –∏–ª–∏ __next__. –ì–µ–Ω–µ—Ä–∞—Ç–æ—Ä—ã –æ–ø—Ä–µ–¥–µ–ª—è—é—Ç—Å—è –∫–∞–∫ —Ñ—É–Ω–∫—Ü–∏–∏. –û–Ω–∏ –∏—Å–ø–æ–ª—å–∑—É—é—Ç –æ–ø–µ—Ä–∞—Ç–æ—Ä yield, —á—Ç–æ–±—ã –æ—Å—Ç–∞–Ω–æ–≤–∏—Ç—å –≥–µ–Ω–µ—Ä–∞—Ç–æ—Ä –∏ –ø–µ—Ä–µ–¥–∞—Ç—å –∑–Ω–∞—á–µ–Ω–∏–µ –æ–±—Ä–∞—Ç–Ω–æ –≤ –æ—Å–Ω–æ–≤–Ω—É—é –ø—Ä–æ–≥—Ä–∞–º–º—É, –ø—Ä–µ–∂–¥–µ —á–µ–º –≤–µ—Ä–Ω—É—Ç—å—Å—è –∫ –µ–µ –æ–±—ã—á–Ω—ã–º –æ–ø–µ—Ä–∞—Ü–∏—è–º.

–ï—Å–ª–∏ –≤—ã –∏—â–µ—Ç–µ –ø—Ä–æ–±–ª–µ–º—É, –≤–æ—Ç –Ω–µ—Å–∫–æ–ª—å–∫–æ –∏–¥–µ–π:

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