Абсолютное значение Python: пошаговое руководство

–ú–µ—Ç–æ–¥ Python abs () –≤–æ–∑–≤—Ä–∞—â–∞–µ—Ç –∞–±—Å–æ–ª—é—Ç–Ω–æ–µ –∑–Ω–∞—á–µ–Ω–∏–µ —á–∏—Å–ª–∞. –ê–±—Å–æ–ª—é—Ç–Ω–æ–µ –∑–Ω–∞—á–µ–Ω–∏–µ —á–∏—Å–ª–∞ - —ç—Ç–æ —Ä–∞—Å—Å—Ç–æ—è–Ω–∏–µ —á–∏—Å–ª–∞ –æ—Ç 0. –≠—Ç–æ –¥–µ–ª–∞–µ—Ç –ª—é–±–æ–µ –æ—Ç—Ä–∏—Ü–∞—Ç–µ–ª—å–Ω–æ–µ —á–∏—Å–ª–æ –ø–æ–ª–æ–∂–∏—Ç–µ–ª—å–Ω—ã–º, –≤ —Ç–æ –≤—Ä–µ–º—è –∫–∞–∫ –ø–æ–ª–æ–∂–∏—Ç–µ–ª—å–Ω—ã–µ —á–∏—Å–ª–∞ –Ω–µ –∑–∞—Ç—Ä–∞–≥–∏–≤–∞—é—Ç—Å—è. –ù–∞–ø—Ä–∏–º–µ—Ä, abs (-9) –≤–µ—Ä–Ω–µ—Ç 9, –∞ abs (2) –≤–µ—Ä–Ω–µ—Ç 2.

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

–ò–º–µ–Ω–Ω–æ –∑–¥–µ—Å—å –∏—Å–ø–æ–ª—å–∑—É–µ—Ç—Å—è –≤—Å—Ç—Ä–æ–µ–Ω–Ω–∞—è —Ñ—É–Ω–∫—Ü–∏—è abs (). abs () –º–æ–∂–Ω–æ –∏—Å–ø–æ–ª—å–∑–æ–≤–∞—Ç—å –¥–ª—è –≤—ã—á–∏—Å–ª–µ–Ω–∏—è –∞–±—Å–æ–ª—é—Ç–Ω–æ–≥–æ –∑–Ω–∞—á–µ–Ω–∏—è –æ–ø—Ä–µ–¥–µ–ª–µ–Ω–Ω–æ–≥–æ —á–∏—Å–ª–∞.

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

–ê–±—Å–æ–ª—é—Ç–Ω–æ–µ –∑–Ω–∞—á–µ–Ω–∏–µ –≤ Python: –æ–±—ä—è—Å–Ω–µ–Ω–∏–µ

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

–ù–∞–ø—Ä–∏–º–µ—Ä, –∞–±—Å–æ–ª—é—Ç–Ω–æ–µ –∑–Ω–∞—á–µ–Ω–∏–µ 5 —Ä–∞–≤–Ω–æ 5. –ê–±—Å–æ–ª—é—Ç–Ω–æ–µ –∑–Ω–∞—á–µ–Ω–∏–µ -5 —Ç–∞–∫–∂–µ —Ä–∞–≤–Ω–æ 5. –î–µ–ª–æ –≤ —Ç–æ–º, —á—Ç–æ –∏ 5, –∏ -5 –Ω–∞—Ö–æ–¥—è—Ç—Å—è –Ω–∞ —Ä–∞—Å—Å—Ç–æ—è–Ω–∏–∏ –ø—è—Ç–∏ –ø—Ä–æ–±–µ–ª–æ–≤ –æ—Ç —á–∏—Å–ª–æ–≤–æ–π —Å—Ç—Ä–æ–∫–∏. –í–æ—Ç –ø—Ä–∏–º–µ—Ä —á–∏—Å–ª–æ–≤–æ–π —Å—Ç—Ä–æ–∫–∏, —á—Ç–æ–±—ã –ø—Ä–æ–∏–ª–ª—é—Å—Ç—Ä–∏—Ä–æ–≤–∞—Ç—å, –∫–∞–∫ —ç—Ç–æ —Ä–∞–±–æ—Ç–∞–µ—Ç:

< td> -4
-5 -3 -2 -1 1 2 3 4 5

-5 - —ç—Ç–æ 5 –ø—Ä–æ–±–µ–ª–æ–≤ –æ—Ç –Ω—É–ª—è, –∞ 5 —Ç–∞–∫–∂–µ 5 –ø—Ä–æ–±–µ–ª–æ–≤ –æ—Ç –Ω—É–ª—è.

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

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

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

Python abs () –≤—ã—á–∏—Å–ª—è–µ—Ç –∞–±—Å–æ–ª—é—Ç–Ω–æ–µ –∑–Ω–∞—á–µ–Ω–∏–µ —á–∏—Å–ª–∞. –ú–µ—Ç–æ–¥ abs () –ø—Ä–∏–Ω–∏–º–∞–µ—Ç –æ–¥–∏–Ω –ø–∞—Ä–∞–º–µ—Ç—Ä: —á–∏—Å–ª–æ, –∞–±—Å–æ–ª—é—Ç–Ω–æ–µ –∑–Ω–∞—á–µ–Ω–∏–µ –∫–æ—Ç–æ—Ä–æ–≥–æ –≤—ã —Ö–æ—Ç–∏—Ç–µ –≤—ã—á–∏—Å–ª–∏—Ç—å.

–í–æ—Ç —Å–∏–Ω—Ç–∞–∫—Å–∏—Å –¥–ª—è abs () –º–µ—Ç–æ–¥:

Abs () –º–µ—Ç–æ–¥ –≤–æ–∑–≤—Ä–∞—â–∞–µ—Ç –ª–∏–±–æ —á–∏—Å–ª–æ —Å –ø–ª–∞–≤–∞—é—â–µ–π –∑–∞–ø—è—Ç–æ–π, –ª–∏–±–æ —Ü–µ–ª–æ–µ —á–∏—Å–ª–æ –≤ –∑–∞–≤–∏—Å–∏–º–æ—Å—Ç–∏ –æ—Ç –∑–Ω–∞—á–µ–Ω–∏—è, –∫–æ—Ç–æ—Ä–æ–µ –≤—ã –ø–µ—Ä–µ–¥–∞–µ—Ç–µ —á–µ—Ä–µ–∑ –º–µ—Ç–æ–¥:

  • -9 –≤–µ—Ä–Ω–µ—Ç 9.
  • -2.2 –≤–µ—Ä–Ω–µ—Ç 2.2.

–ó–Ω–∞—á–µ–Ω–∏–µ —Å –ø–ª–∞–≤–∞—é—â–µ–π –∑–∞–ø—è—Ç–æ–π - 2,2, –æ–±–æ–∑–Ω–∞—á–µ–Ω–Ω–æ–µ —Ç–æ—á–∫–æ–π, –∫–æ—Ç–æ—Ä–∞—è –ø–æ—è–≤–ª—è–µ—Ç—Å—è –≤ —á–∏—Å–ª–µ. –ü–æ—Å–∫–æ–ª—å–∫—É abs () –ø—Ä–∏–Ω–∏–º–∞–µ—Ç –∫–∞–∫ —Ü–µ–ª—ã–µ —á–∏—Å–ª–∞, —Ç–∞–∫ –∏ —á–∏—Å–ª–∞ —Å –ø–ª–∞–≤–∞—é—â–µ–π –∑–∞–ø—è—Ç–æ–π, –¥–ª—è –∏—Å–ø–æ–ª—å–∑–æ–≤–∞–Ω–∏—è —ç—Ç–æ–≥–æ –º–µ—Ç–æ–¥–∞ —á–∏—Å–ª–æ–≤–æ–µ –ø—Ä–µ–æ–±—Ä–∞–∑–æ–≤–∞–Ω–∏–µ –Ω–µ —Ç—Ä–µ–±—É–µ—Ç—Å—è.

abs () —Ä–∞–±–æ—Ç–∞–µ—Ç —Å –Ω—É–ª–µ–≤—ã–º–∏ –∑–Ω–∞—á–µ–Ω–∏—è–º–∏ –∏ –ø–æ–ª–æ–∂–∏—Ç–µ–ª—å–Ω—ã–º–∏ —á–∏—Å–ª–∞–º–∏ (–≤–∫–ª—é—á–∞—è —á–∏—Å–ª–∞ —Å –ø–ª–∞–≤–∞—é—â–µ–π –∑–∞–ø—è—Ç–æ–π. –∏ —Ü–µ–ª—ã–µ —á–∏—Å–ª–∞). –û–¥–Ω–∞–∫–æ —Ñ—É–Ω–∫—Ü–∏—è abs () –≤–µ—Ä–Ω–µ—Ç —Ç–æ –∂–µ –∑–Ω–∞—á–µ–Ω–∏–µ, —á—Ç–æ –∏ –∑–Ω–∞—á–µ–Ω–∏–µ, –ø–µ—Ä–≤–æ–Ω–∞—á–∞–ª—å–Ω–æ –ø—Ä–æ–∞–Ω–∞–ª–∏–∑–∏—Ä–æ–≤–∞–Ω–Ω–æ–µ —Ñ—É–Ω–∫—Ü–∏–µ–π. –≠—Ç–æ –ø–æ–ª–æ–∂–∏—Ç–µ–ª—å–Ω—ã–µ —á–∏—Å–ª–∞, –∞ –Ω—É–ª–µ–≤—ã–µ –∑–Ω–∞—á–µ–Ω–∏—è –Ω–µ —è–≤–ª—è—é—Ç—Å—è –æ—Ç—Ä–∏—Ü–∞—Ç–µ–ª—å–Ω—ã–º–∏ —á–∏—Å–ª–∞–º–∏.

–î–∞–≤–∞–π—Ç–µ –≤–æ—Å–ø–æ–ª—å–∑—É–µ–º—Å—è –ø—Ä–∏–º–µ—Ä–æ–º, —á—Ç–æ–±—ã –ø—Ä–æ–∏–ª–ª—é—Å—Ç—Ä–∏—Ä–æ–≤–∞—Ç—å, –∫–∞–∫ —Ä–∞–±–æ—Ç–∞–µ—Ç –º–µ—Ç–æ–¥ abs ().

Python –ü—Ä–∏–º–µ—Ä –º–µ—Ç–æ–¥–∞ abs ()

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

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

–î–≤–∏–∂–µ–Ω–∏–µ —Å–æ —Å–∫–æ—Ä–æ—Å—Ç—å—é –±–æ–ª–µ–µ 10 –º–∏–ª—å (–æ–∫–æ–ª–æ 16 –∫–º) –≤ —á–∞—Å (–æ–∫–æ–ª–æ 16 –∫–º / —á) –±—ã—Å—Ç—Ä–µ–µ –∏–ª–∏ –º–µ–¥–ª–µ–Ω–Ω–µ–µ, —á–µ–º —Å—Ä–µ–¥–Ω–∏–π –≤–æ–¥–∏—Ç–µ–ª—å, –ø—Ä–µ–¥—Å—Ç–∞–≤–ª—è–µ—Ç –æ–ø–∞—Å–Ω–æ—Å—Ç—å . –í–æ–¥–∏—Ç–µ–ª–∏, –∫–æ—Ç–æ—Ä—ã–µ –ø—Ä–µ–≤—ã—à–∞—é—Ç —ç—Ç–æ—Ç –ª–∏–º–∏—Ç, –¥–æ–ª–∂–Ω—ã –ø–æ–ª—É—á–∏—Ç—å –±–∏–ª–µ—Ç.

–û—Ü–µ–Ω–∫–∞ —Å–∫–æ—Ä–æ—Å—Ç–∏

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

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

–ê–±—Å–æ–ª—é—Ç–Ω–æ–µ –∑–Ω–∞—á–µ–Ω–∏–µ Python: —Ä–∞—Å—á–µ—Ç —Ä–∞—Å—Å—Ç–æ—è–Ω–∏–π

–ê–±—Å–æ–ª—é—Ç–Ω—ã–µ –∑–Ω–∞—á–µ–Ω–∏—è –æ–±—ã—á–Ω–æ –∏—Å–ø–æ–ª—å–∑—É—é—Ç—Å—è –ø—Ä–∏ —Ä–∞—Å—á–µ—Ç–∞—Ö —Ä–∞—Å—Å—Ç–æ—è–Ω–∏–π.

–î–æ–ø—É—Å—Ç–∏–º, –º—ã –ø—ã—Ç–∞–µ–º—Å—è —á—Ç–æ–±—ã –ø—Ä–æ–µ—Ö–∞—Ç—å –≥–¥–µ-–Ω–∏–±—É–¥—å –≤ 20 –º–∏–ª—è—Ö (–ø—Ä–∏–º–µ—Ä–Ω–æ 32 –∫–º) –æ—Ç –Ω–∞—à–µ–≥–æ –¥–æ–º–∞. –ú—ã —Å–ª—É—á–∞–π–Ω–æ –ø—Ä–æ–µ—Ö–∞–ª–∏ 31 –º–∏–ª—é.

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

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

< p> –ï—Å–ª–∏ –±—ã –º—ã —Ö–æ—Ç–µ–ª–∏ —É–∑–Ω–∞—Ç—å, —Å–∫–æ–ª—å–∫–æ –º–∏–ª—å –Ω–∞–º –æ—Å—Ç–∞–ª–æ—Å—å –¥–æ –¥–æ—Å—Ç–∏–∂–µ–Ω–∏—è –ø—É–Ω–∫—Ç–∞ –Ω–∞–∑–Ω–∞—á–µ–Ω–∏—è, –º—ã –ø–æ–ª—É—á–∏–ª–∏ –±—ã –æ—Ç—Ä–∏—Ü–∞—Ç–µ–ª—å–Ω–æ–µ —á–∏—Å–ª–æ. –ß—Ç–æ–±—ã –ø—Ä–µ–æ–±—Ä–∞–∑–æ–≤–∞—Ç—å —ç—Ç–æ –æ—Ç—Ä–∏—Ü–∞—Ç–µ–ª—å–Ω–æ–µ —á–∏—Å–ª–æ –≤ –ø–æ–ª–æ–∂–∏—Ç–µ–ª—å–Ω–æ–µ, –º—ã –º–æ–≥–ª–∏ –±—ã –∏—Å–ø–æ–ª—å–∑–æ–≤–∞—Ç—å abs ().

–í–æ—Ç –∫–æ–¥ –¥–ª—è –ø—Ä–∏–º–µ—Ä–∞, –∫–æ—Ç–æ—Ä—ã–π –∏—Å–ø–æ–ª—å–∑—É–µ—Ç —Ñ—É–Ω–∫—Ü–∏—é abs () –≤ Python:

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

–ï—Å–ª–∏ –±—ã –º—ã –Ω–µ —É–∫–∞–∑–∞–ª–∏ abs (), –Ω–∞—à–∞ –ø—Ä–æ–≥—Ä–∞–º–º–∞ –≤–µ—Ä–Ω—É–ª–∞ –±—ã -11, –ø–æ—Ç–æ–º—É —á—Ç–æ —Ä–∞–∑–Ω–∏—Ü–∞ –º–µ–∂–¥—É 20 –∏ 31 —Ä–∞–≤–Ω–∞ -11. –û–¥–Ω–∞–∫–æ, –ø–æ—Å–∫–æ–ª—å–∫—É –º—ã –∏—Å–ø–æ–ª—å–∑–æ–≤–∞–ª–∏ abs (), –Ω–∞—à–∞ –ø—Ä–æ–≥—Ä–∞–º–º–∞ –≤–µ—Ä–Ω—É–ª–∞ –∞–±—Å–æ–ª—é—Ç–Ω–æ–µ –∑–Ω–∞—á–µ–Ω–∏–µ.

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

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

–í —ç—Ç–æ–º —Ä—É–∫–æ–≤–æ–¥—Å—Ç–≤–µ –º—ã –∏—Å—Å–ª–µ–¥–æ–≤–∞–ª–∏, –∫–∞–∫ –∏—Å–ø–æ–ª—å–∑–æ–≤–∞—Ç—å abs () –≤ Python, —Å–æ —Å—Å—ã–ª–∫–æ–π –Ω–∞ –¥–≤–∞ –ø—Ä–∏–º–µ—Ä–∞.

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