Python IndentationError: ожидается блок с отступом Решение

–û—Ç—Å—Ç—É–ø—ã –≤ Python - –Ω–∞—Å—Ç–æ–π—á–∏–≤—ã–µ. –í—ã –¥–æ–ª–∂–Ω—ã –ø—Ä–∞–≤–∏–ª—å–Ω–æ —Å–¥–µ–ª–∞—Ç—å –æ—Ç—Å—Ç—É–ø –≤ –∫–æ–¥–µ.

–ï—Å–ª–∏ –≤—ã –∏—Å–ø–æ–ª—å–∑—É–µ—Ç–µ –Ω–µ–ø—Ä–∞–≤–∏–ª—å–Ω–æ–µ —Ä–∞—Å–ø–æ–ª–æ–∂–µ–Ω–∏–µ –ø—Ä–æ–±–µ–ª–æ–≤ –∏ —Ç–∞–±—É–ª—è—Ü–∏–∏ –≤ –ø—Ä–æ–≥—Ä–∞–º–º–µ Python, –≤—ã —Å—Ç–æ–ª–∫–Ω–µ—Ç–µ—Å—å —Å –æ—à–∏–±–∫–æ–π " IndentationError: –æ–∂–∏–¥–∞–µ—Ç—Å—è –±–ª–æ–∫ —Å –æ—Ç—Å—Ç—É–ø–æ–º " –æ—à–∏–±–∫–∞.

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

IndentationError: –æ–∂–∏–¥–∞–µ—Ç—Å—è –±–ª–æ–∫ —Å –æ—Ç—Å—Ç—É–ø–æ–º

–¢–∞–∫–∏–µ —è–∑—ã–∫–∏ –ø—Ä–æ–≥—Ä–∞–º–º–∏—Ä–æ–≤–∞–Ω–∏—è, –∫–∞–∫ C –∏ JavaScript, –¥–µ–ª–∞—é—Ç –Ω–µ —Ç—Ä–µ–±—É–µ—Ç –æ—Å–æ–±–æ–≥–æ –æ—Ç—Å—Ç—É–ø–∞. –≠—Ç–æ –ø–æ—Ç–æ–º—É, —á—Ç–æ –æ–Ω–∏ –∏—Å–ø–æ–ª—å–∑—É—é—Ç —Ñ–∏–≥—É—Ä–Ω—ã–µ —Å–∫–æ–±–∫–∏ –¥–ª—è –æ–±–æ–∑–Ω–∞—á–µ–Ω–∏—è —Å—Ç—Ä—É–∫—Ç—É—Ä—ã –∫–æ–¥–æ–≤—ã—Ö –±–ª–æ–∫–æ–≤. Python –Ω–µ –∏—Å–ø–æ–ª—å–∑—É–µ—Ç —Ñ–∏–≥—É—Ä–Ω—ã–µ —Å–∫–æ–±–∫–∏ –∏–ª–∏ –∞–Ω–∞–ª–æ–≥–∏—á–Ω—ã–µ –∏–Ω–¥–∏–∫–∞—Ç–æ—Ä—ã.

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

–†–∞—Å—Å–º–æ—Ç—Ä–∏–º —Å–ª–µ–¥—É—é—â–∏–π –∫–æ–¥ Python:

–ö–∞–∫ Python —É–∑–Ω–∞–µ—Ç, –∫–∞–∫–æ–π –∫–æ–¥ —è–≤–ª—è–µ—Ç—Å—è —á–∞—Å—Ç—å—é find_average () –æ–ø—Ä–µ–¥–µ–ª–µ–Ω–Ω–æ–π —Ñ—É–Ω–∫—Ü–∏–∏ –∏ –∫–∞–∫–æ–π –∫–æ–¥ —è–≤–ª—è–µ—Ç—Å—è —á–∞—Å—Ç—å—é –æ—Å–Ω–æ–≤–Ω–æ–π –ø—Ä–æ–≥—Ä–∞–º–º—ã? –≠—Ç–æ –ø–æ–∫–∞–∑—ã–≤–∞–µ—Ç, –ø–æ—á–µ–º—É –æ—Ç—Å—Ç—É–ø—ã —Ç–∞–∫ –≤–∞–∂–Ω—ã.

–ö–∞–∂–¥—ã–π —Ä–∞–∑, –∫–æ–≥–¥–∞ –≤—ã –∑–∞–±—ã–≤–∞–µ—Ç–µ —Å–¥–µ–ª–∞—Ç—å –æ—Ç—Å—Ç—É–ø –≤ –∫–æ–¥–µ –ø—Ä–æ–≥—Ä–∞–º–º—ã, Python —Å–æ–æ–±—â–∞–µ—Ç –≤–∞–º –æ–± —ç—Ç–æ–º, –≤—ã–∑—ã–≤–∞—è –æ—à–∏–±–∫–∞ –æ—Ç—Å—Ç—É–ø–∞ .

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

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

–î–∞–≤–∞–π—Ç–µ –Ω–∞–ø–∏—à–µ–º –ø—Ä–æ–≥—Ä–∞–º–º—É. –∫–æ—Ç–æ—Ä—ã–π –∏–∑–≤–ª–µ–∫–∞–µ—Ç –≤—Å–µ —Ä–æ–≥–∞–ª–∏–∫–∏ –∏–∑ —Å–ø–∏—Å–∫–∞ –æ–±–µ–¥–æ–≤ –≤ –æ–±–µ–¥–µ–Ω–Ω–æ–º –º–µ–Ω—é –∫–∞—Ñ–µ. –≠—Ç–∏ —Ä–æ–≥–∞–ª–∏–∫–∏ –±—É–¥—É—Ç –¥–æ–±–∞–≤–ª–µ–Ω—ã –≤ –∏—Ö —Å–æ–±—Å—Ç–≤–µ–Ω–Ω—ã–π —Å–ø–∏—Å–æ–∫.

–î–∞–≤–∞–π—Ç–µ –Ω–∞—á–Ω–µ–º —Å –æ–ø—Ä–µ–¥–µ–ª–µ–Ω–∏—è —Å–ø–∏—Å–∫–∞ –≤—Å–µ—Ö –ø—Ä–æ–¥—É–∫—Ç–æ–≤, –¥–æ—Å—Ç—É–ø–Ω—ã—Ö –≤ –æ–±–µ–¥–µ–Ω–Ω–æ–µ –≤—Ä–µ–º—è:

–í –Ω–∞—à–µ–º –æ–±–µ–¥–µ–Ω–Ω–æ–º –º–µ–Ω—é –¥–≤–∞ —Å—ç–Ω–¥–≤–∏—á–∞ –∏ –¥–≤–∞ —Ä–æ–≥–∞–ª–∏–∫–∞. –ó–∞—Ç–µ–º –º—ã –ø–∏—à–µ–º —Ñ—É–Ω–∫—Ü–∏—é, –∫–æ—Ç–æ—Ä–∞—è —Å–æ–∑–¥–∞–µ—Ç –Ω–æ–≤—ã–π —Å–ø–∏—Å–æ–∫ —Ä–æ–≥–∞–ª–∏–∫–æ–≤ –Ω–∞ –æ—Å–Ω–æ–≤–µ —Å–æ–¥–µ—Ä–∂–∏–º–æ–≥–æ –Ω–∞—à–µ–≥–æ " –æ–±–µ–¥_–º–µ–Ω—é " list:

–ù–∞—à–∞ —Ñ—É–Ω–∫—Ü–∏—è get_bagels () –ø—Ä–∏–Ω–∏–º–∞–µ—Ç –æ–¥–∏–Ω –∞—Ä–≥—É–º–µ–Ω—Ç: –ø—É–Ω–∫—Ç—ã –º–µ–Ω—é, –ø–æ –∫–æ—Ç–æ—Ä—ã–º —Ñ—É–Ω–∫—Ü–∏—è –¥–æ–ª–∂–Ω–∞ –∏—Å–∫–∞—Ç—å. –ù–∞—à–∞ —Ñ—É–Ω–∫—Ü–∏—è –≤—ã–ø–æ–ª–Ω—è–µ—Ç –∏—Ç–µ—Ä–∞—Ü–∏—é –ø–æ –∫–∞–∂–¥–æ–º—É —ç–ª–µ–º–µ–Ω—Ç—É –º–µ–Ω—é –∏ –ø—Ä–æ–≤–µ—Ä—è–µ—Ç, —Å–æ–¥–µ—Ä–∂–∏—Ç –ª–∏ —ç–ª–µ–º–µ–Ω—Ç —Å–ª–æ–≤–æ " –±—É–±–ª–∏–∫ " . –ï—Å–ª–∏ –¥–∞, —Ç–æ —ç—Ç–æ—Ç –æ–±–µ–¥ –¥–æ–±–∞–≤–ª—è–µ—Ç—Å—è –∫ " —Ä–æ–≥–∞–ª–∏–∫–∞–º " —Å–ø–∏—Å–æ–∫.

–ù–∞–∫–æ–Ω–µ—Ü, –º—ã –¥–æ–ª–∂–Ω—ã –≤—ã–∑–≤–∞—Ç—å –Ω–∞—à—É —Ñ—É–Ω–∫—Ü–∏—é –≤ –Ω–∞—à–µ–π –æ—Å–Ω–æ–≤–Ω–æ–π –ø—Ä–æ–≥—Ä–∞–º–º–µ:

–≠—Ç–æ—Ç –∫–æ–¥ –≤—ã–∑–æ–≤–µ—Ç –Ω–∞—à—É —Ñ—É–Ω–∫—Ü–∏—é get_bagels () –∏ –∑–∞—Ç–µ–º —Ä–∞—Å–ø–µ—á–∞—Ç–∞–π—Ç–µ —Å–æ–∑–¥–∞–Ω–Ω—ã–π –∏–º —Å–ø–∏—Å–æ–∫ –±—É–±–ª–∏–∫–æ–≤ –Ω–∞ –∫–æ–Ω—Å–æ–ª—å. –î–∞–≤–∞–π—Ç–µ –∑–∞–ø—É—Å—Ç–∏–º –Ω–∞—à –∫–æ–¥ –∏ –ø–æ—Å–º–æ—Ç—Ä–∏–º, —á—Ç–æ –ø—Ä–æ–∏–∑–æ–π–¥–µ—Ç:

–ù–∞—à –∫–æ–¥ –Ω–µ –º–æ–∂–µ—Ç –≤—ã–ø–æ–ª–Ω—è—Ç—å—Å—è.

–û—à–∏–±–∫–∞ IndentationError —Å–æ–æ–±—â–∞–µ—Ç –Ω–∞–º, —á—Ç–æ –º—ã –Ω–µ–ø—Ä–∞–≤–∏–ª—å–Ω–æ —Å–¥–µ–ª–∞–ª–∏ –æ—Ç—Å—Ç—É–ø –≤ –Ω–∞—à–µ–º –∫–æ–¥–µ. –°–æ–æ–±—â–µ–Ω–∏–µ –æ–± –æ—à–∏–±–∫–µ –ø–æ–∫–∞–∑—ã–≤–∞–µ—Ç –Ω–∞–º, —á—Ç–æ –æ–∂–∏–¥–∞–µ—Ç—Å—è –æ—Ç—Å—Ç—É–ø –≤ —á–µ—Ç–≤–µ—Ä—Ç–æ–π —Å—Ç—Ä–æ–∫–µ. –í–∑–≥–ª—è–Ω–∏—Ç–µ –Ω–∞ –Ω–∞—à –∫–æ–¥:

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

–ß—Ç–æ–±—ã —Ä–µ—à–∏—Ç—å —ç—Ç—É –æ—à–∏–±–∫—É, –Ω–∞–º –Ω—É–∂–Ω–æ —Å–¥–µ–ª–∞—Ç—å –æ—Ç—Å—Ç—É–ø –≤ –Ω–∞—à–µ–º –æ–±—ä—è–≤–ª–µ–Ω–∏–µ –ø–µ—Ä–µ–º–µ–Ω–Ω–æ–π :

–î–∞–≤–∞–π—Ç–µ –∑–∞–ø—É—Å—Ç–∏–º –Ω–∞—à –∫–æ–¥:

–ù–∞—à –∫–æ–¥ –Ω–∞—Ö–æ–¥–∏—Ç –≤—Å–µ –±—É–±–ª–∏–∫–∏ –≤ –Ω–∞—à–µ–º " –æ–±–µ–¥_–º–µ–Ω—é " —Å–ø–∏—Å–æ–∫ –∏ –¥–æ–±–∞–≤–ª—è–µ—Ç –∏—Ö –≤ " –±—É–±–ª–∏–∫–∏ " —Å–ø–∏—Å–æ–∫. –ó–∞—Ç–µ–º –Ω–∞—à –∫–æ–¥ –≤—ã–≤–æ–¥–∏—Ç —Å–ø–∏—Å–æ–∫ –±—É–±–ª–∏–∫–æ–≤ –Ω–∞ –∫–æ–Ω—Å–æ–ª—å. –í –æ–±–µ–¥–µ–Ω–Ω–æ–º –º–µ–Ω—é –¥–≤–∞ —Ä–æ–≥–∞–ª–∏–∫–∞.

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

–û—à–∏–±–∫–∞ " IndentationError: –æ–∂–∏–¥–∞–ª—Å—è –±–ª–æ–∫ —Å –æ—Ç—Å—Ç—É–ø–æ–º " –æ—à–∏–±–∫–∞ –≤–æ–∑–Ω–∏–∫–∞–µ—Ç, –∫–æ–≥–¥–∞ –≤—ã –∑–∞–±—ã–≤–∞–µ—Ç–µ –¥–æ–±–∞–≤–∏—Ç—å –æ—Ç—Å—Ç—É–ø –≤ —Å–≤–æ–π –∫–æ–¥.

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

Shop

Learn programming in R: courses

$

Best Python online courses for 2022

$

Best laptop for Fortnite

$

Best laptop for Excel

$

Best laptop for Solidworks

$

Best laptop for Roblox

$

Best computer for crypto mining

$

Best laptop for Sims 4

$

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

12 answers

NUMPYNUMPY

How to convert Nonetype to int or string?

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

12 answers

News


Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method