{"id":1304,"date":"2021-05-23T11:53:58","date_gmt":"2021-05-23T11:53:58","guid":{"rendered":"https:\/\/otus.ru\/journal\/?p=1304"},"modified":"2021-05-23T11:53:59","modified_gmt":"2021-05-23T11:53:59","slug":"izvlechenie-kornya-v-python","status":"publish","type":"post","link":"https:\/\/otus.ru\/journal\/izvlechenie-kornya-v-python\/","title":{"rendered":"\u0418\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0440\u043d\u044f \u0432 Python"},"content":{"rendered":"\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, <strong>\u043a\u0430\u043a \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u043a\u043e\u0440\u0435\u043d\u044c \u0432 Python<\/strong>, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043a\u0430\u043a\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f. \u041d\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u0431\u043e \u0432\u0441\u0435\u043c \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443.<\/p>\n\n\n\n<p>\u0415\u0441\u043b\u0438 \u043c\u044b \u0437\u043d\u0430\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u0449\u0443\u044e \u043f\u043b\u043e\u0449\u0430\u0434\u044c \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0430 \u0438 \u0445\u043e\u0442\u0438\u043c \u0443\u0437\u043d\u0430\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 \u043e\u0434\u043d\u043e\u0439 \u0435\u0433\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043b\u0438\u0431\u043e \u0436\u0435 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 2-\u043c\u044f \u0442\u043e\u0447\u043a\u0430\u043c\u0438 \u0432 \u0434\u0435\u043a\u0430\u0440\u0442\u043e\u0432\u044b\u0445 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u0445, \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f <strong>\u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u044b\u0439 \u043a\u043e\u0440\u0435\u043d\u044c<\/strong>. \u042d\u0442\u043e \u043d\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u0435\u0441\u043b\u0438 \u0440\u0435\u0447\u044c \u0438\u0434\u0435\u0442 \u043e \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0435. \u041d\u043e \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c, \u043a\u043e\u0433\u0434\u0430 \u0440\u0435\u0447\u044c \u0438\u0434\u0435\u0442 \u043e \u044f\u0437\u044b\u043a\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f? \u041a \u043d\u0430\u0448\u0435\u043c\u0443 \u0441\u0447\u0430\u0441\u0442\u044c\u044e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 <strong>Python <\/strong>\u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432\u044b\u0448\u0435\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e. \u041d\u043e \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043c \u0442\u0435\u043e\u0440\u0438\u044e.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u041a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u044b\u0439 \u043a\u043e\u0440\u0435\u043d\u044c \u2014 \u0447\u0442\u043e \u044d\u0442\u043e?<\/h2>\n\n\n\n<p>\u041a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u044b\u043c \u043a\u043e\u0440\u043d\u0435\u043c, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u043c \u0438\u0437 \u0447\u0438\u0441\u043b\u0430 &#171;A&#187;, \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u0447\u0438\u0441\u043b\u043e &#171;B&#187;, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0438 \u0432\u043e\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0438 \u0432\u043e 2-\u044e \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u0434\u0430\u0441\u0442 \u0432 \u0438\u0442\u043e\u0433\u0435 \u0442\u043e \u0441\u0430\u043c\u043e\u0435 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e &#171;A&#187;.<\/p>\n\n\n\n<p><code>B<sup>2<\/sup> = A<\/code><\/p>\n\n\n\n<p>\u041d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0443\u044e \u043d\u0430\u0439\u0442\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 &#171;B&#187;, \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u0435\u043c \u043a\u043e\u0440\u043d\u044f \u0438\u0437 &#171;A&#187;. \u041c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044e\u0442 \u0434\u043b\u044f \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0437\u043d\u0430\u043a (\u0435\u0433\u043e \u0435\u0449\u0435 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u0437\u043d\u0430\u043a\u043e\u043c \u0440\u0430\u0434\u0438\u043a\u0430\u043b\u0430):<\/p>\n\n\n\n<p><code>B = \u221aA<\/code><\/p>\n\n\n\n<p>\u041a\u043e\u0433\u0434\u0430 \u0440\u0435\u0447\u044c \u0438\u0434\u0435\u0442 \u043e \u043a\u043e\u0440\u043d\u0435 \u0432 \u00ab\u041f\u0438\u0442\u043e\u043d\u0435\u00bb, \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u043e\u0431\u0441\u0442\u043e\u0438\u0442 \u0438\u043d\u0430\u0447\u0435, \u043f\u0440\u0438\u0447\u0435\u043c \u0432 \u043e\u0431\u043e\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0441\u0430\u043c\u043e \u0432\u043e\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0447\u0438\u0441\u043b\u0430 \u0432 \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 &#171;<strong>**<\/strong>&#171;:<\/p>\n\n\n\n<p><code>X = 2<\/code><\/p>\n\n\n\n<p><code>Y = X ** 2<\/code><\/p>\n\n\n\n<p><code>print(Y)<\/code><\/p>\n\n\n\n<p>\u041e\u0442\u0432\u0435\u0442 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u00ab\u041f\u0430\u0439\u0442\u043e\u043d\u0430\u00bb \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u043d\u044f\u0442\u044c\u0441\u044f \u0447\u0435\u0442\u044b\u0440\u0435\u043c.<\/p>\n\n\n\n<p>\u041a\u0430\u0441\u0430\u0435\u043c\u043e \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043a\u043e\u0440\u043d\u044f, \u0442\u043e \u043e\u043d \u0432 Python \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 <strong>sqrt<\/strong>(). \u041e\u0434\u043d\u0430\u043a\u043e \u043e\u043d\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0435 \u0441\u0430\u043c\u0430 \u043f\u043e \u0441\u0435\u0431\u0435, \u0430 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f <strong>math<\/strong>. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u0447\u0430\u043b\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u044d\u0442\u043e\u0442 \u043c\u043e\u0434\u0443\u043b\u044c \u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043d\u043e \u044d\u0442\u043e \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435:<\/p>\n\n\n\n<p><code><strong>import<\/strong> math<\/code><\/p>\n\n\n\n<p>\u0418\u0434\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435. \u041d\u0430\u0448\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <strong>sqrt<\/strong>() \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043b\u0438\u0448\u044c \u043e\u0434\u0438\u043d \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u2013 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0438\u0437\u0432\u043b\u0435\u0447\u044c <strong>\u221a<\/strong>. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 \u043a\u043e\u0434 \u0438 \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u043c float \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0442\u0438\u043f\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f.<\/p>\n\n\n\n<p><code><strong>import<\/strong> math<\/code><\/p>\n\n\n\n<p><code><strong>import<\/strong> random<\/code><\/p>\n\n\n\n<p><em><code># \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e sqrt() \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435<\/code><\/em><\/p>\n\n\n\n<p><em><code># \u043d\u0430\u0439\u0434\u0435\u043c \u043a\u043e\u0440\u0435\u043d\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0432\u044b\u0432\u043e\u0434\u043e\u043c \u0435\u0433\u043e \u043d\u0430 \u044d\u043a\u0440\u0430\u043d<\/code><\/em><\/p>\n\n\n\n<p><code>rand_num = random.randint(5, 55)<\/code><\/p>\n\n\n\n<p><code>sqrt_rand_num = math.sqrt(rand_num)<\/code><\/p>\n\n\n\n<p><code>print('\u041d\u0430\u0448\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e = ', rand_num)<\/code><\/p>\n\n\n\n<p><code>print('\u0418\u0441\u043a\u043e\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0440\u043d\u044f = ', sqrt_rand_num)<\/code><\/p>\n\n\n\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0443 \u0441\u0435\u0431\u044f \u043d\u0430 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435 \u0438\u043b\u0438 \u043d\u0430 \u043b\u044e\u0431\u043e\u043c \u043e\u043d\u043b\u0430\u0439\u043d-\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0435. \u0412\u043e\u0442, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, <a href=\"https:\/\/www.onlinegdb.com\/online_python_compiler\">\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0434\u043b\u044f Python 3<\/a>.<\/p>\n\n\n\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u0430\u043a\u0438\u043c:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"761\" height=\"362\" src=\"https:\/\/otus.ru\/journal\/wp-content\/uploads\/2021\/05\/1-4.png\" alt=\"\" class=\"wp-image-1306\" srcset=\"https:\/\/otus.ru\/journal\/wp-content\/uploads\/2021\/05\/1-4.png 761w, https:\/\/otus.ru\/journal\/wp-content\/uploads\/2021\/05\/1-4-300x143.png 300w, https:\/\/otus.ru\/journal\/wp-content\/uploads\/2021\/05\/1-4-150x71.png 150w\" sizes=\"auto, (max-width: 761px) 100vw, 761px\" \/><\/figure>\n\n\n\n<p>\u0418\u043b\u0438 \u0442\u0430\u043a\u0438\u043c:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"722\" height=\"271\" src=\"https:\/\/otus.ru\/journal\/wp-content\/uploads\/2021\/05\/2-3.png\" alt=\"\" class=\"wp-image-1307\" srcset=\"https:\/\/otus.ru\/journal\/wp-content\/uploads\/2021\/05\/2-3.png 722w, https:\/\/otus.ru\/journal\/wp-content\/uploads\/2021\/05\/2-3-300x113.png 300w, https:\/\/otus.ru\/journal\/wp-content\/uploads\/2021\/05\/2-3-150x56.png 150w\" sizes=\"auto, (max-width: 722px) 100vw, 722px\" \/><\/figure>\n\n\n\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c random, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u043a\u043e\u0434\u0430.<\/p>\n\n\n\n<p>\u041d\u043e \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u043c\u0435\u0448\u0430\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0441\u0435 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0449\u0435:<\/p>\n\n\n\n<p><code>print (math.sqrt(64))<\/code><\/p>\n\n\n\n<p>\u041e\u0442\u0432\u0435\u0442 \u043e\u0447\u0435\u0432\u0438\u0434\u0435\u043d:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"408\" height=\"214\" src=\"https:\/\/otus.ru\/journal\/wp-content\/uploads\/2021\/05\/3-3.png\" alt=\"\" class=\"wp-image-1308\" srcset=\"https:\/\/otus.ru\/journal\/wp-content\/uploads\/2021\/05\/3-3.png 408w, https:\/\/otus.ru\/journal\/wp-content\/uploads\/2021\/05\/3-3-300x157.png 300w, https:\/\/otus.ru\/journal\/wp-content\/uploads\/2021\/05\/3-3-150x79.png 150w\" sizes=\"auto, (max-width: 408px) 100vw, 408px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u041f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430<\/h2>\n\n\n\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <strong>sqrt<\/strong>() \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438. \u0415\u0441\u043b\u0438 \u0447\u0438\u0441\u043b\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043b\u0438\u0431\u043e \u0440\u0430\u0432\u043d\u043e \u043d\u0443\u043b\u044e, \u0442\u043e \u043d\u0435\u0432\u0430\u0436\u043d\u043e, \u043a\u0430\u043a\u043e\u0439 \u0442\u0438\u043f \u0434\u0430\u043d\u043d\u044b\u0445 \u0443 \u043d\u0435\u0433\u043e, \u0432\u0435\u0434\u044c \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0440\u043d\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043a\u0430\u043a \u0438\u0437 \u0446\u0435\u043b\u044b\u0445, \u0442\u0430\u043a \u0438 \u0438\u0437 \u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b.<\/p>\n\n\n\n<p><strong>\u0418\u0437 \u0446\u0435\u043b\u044b\u0445<\/strong>:<\/p>\n\n\n\n<p><code>import math<\/code><\/p>\n\n\n\n<p><code>print(math.sqrt(81))<\/code><\/p>\n\n\n\n<p><code>> 9.0<\/code><\/p>\n\n\n\n<p><strong>\u0418\u0437 \u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445:<\/strong><\/p>\n\n\n\n<p><code>print(math.sqrt(81.5))<\/code><\/p>\n\n\n\n<p><code>> 9.027735042633894<\/code><\/p>\n\n\n\n<p>\u0421\u043e\u043c\u043d\u0435\u0432\u0430\u0435\u0442\u0435\u0441\u044c \u0432 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u0438 \u0438\u0442\u043e\u0433\u043e\u0432\u044b\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430? \u041f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0435 \u0432\u043e\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 \u0441\u0442\u0435\u043f\u0435\u043d\u044c:<\/p>\n\n\n\n<p><code>print(9.027735042633894 ** 2)<\/code><\/p>\n\n\n\n<p><code>> 81.5<\/code><\/p>\n\n\n\n<p>\u0422\u0430\u043a\u0436\u0435 \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0439\u0442\u0435, \u0447\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <em>pow:<\/em><\/p>\n\n\n\n<p><code>print(pow(9.027735042633894, 2))<\/code><\/p>\n\n\n\n<p><code>> 81.5<\/code><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u041e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438 \u043d\u043e\u043b\u044c<\/h2>\n\n\n\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <strong>sqrt <\/strong>\u0432 \u00ab\u041f\u0438\u0442\u043e\u043d\u0435\u00bb \u2014 \u0432\u0435\u0449\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u0430\u044f \u0438 \u0437\u043d\u0430\u0442\u044c \u0435\u0435 \u043d\u0443\u0436\u043d\u043e, \u043e\u0434\u043d\u0430\u043a\u043e \u043e\u043d\u0430 \u043d\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u2014 \u043b\u0438\u0448\u044c \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 (\u0446\u0435\u043b\u044b\u0435 \u0438 \u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435), \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u043e\u043b\u044c.<\/p>\n\n\n\n<p>\u0422\u0430\u043a\u0430\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u0430\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043a\u0430\u043d\u043e\u043d\u0430\u043c, \u0432\u0435\u0434\u044c \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u0436\u0438\u0437\u043d\u0438 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0441\u0442\u044b \u043f\u043e \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0435 \u0431\u0435\u0437 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u044e\u0442 <strong>\u221a <\/strong>\u0438 \u0438\u0437 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. \u0414\u0430, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u044b\u043c \u0438 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0443\u0437\u043a\u043e\u0433\u043e \u0441\u043f\u0435\u043a\u0442\u0440\u0430 \u0437\u0430\u0434\u0430\u0447, \u0442\u0438\u043f\u0430 \u0440\u0430\u0441\u0447\u0435\u0442\u043e\u0432 \u0432\u043e\u043b\u043d\u043e\u0432\u044b\u0445 \u044f\u0432\u043b\u0435\u043d\u0438\u0439 \u0432 \u0444\u0438\u0437\u0438\u043a\u0435 \u043b\u0438\u0431\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u0432 \u044d\u043d\u0435\u0440\u0433\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0441\u0444\u0435\u0440\u0435.<\/p>\n\n\n\n<p>\u0423\u0447\u0438\u0442\u044b\u0432\u0430\u0439\u0442\u0435 \u0432\u044b\u0448\u0435\u0441\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435, \u0435\u0441\u043b\u0438 \u043f\u044b\u0442\u0430\u0435\u0442\u0435\u0441\u044c \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0442\u044c \u043a\u043e\u0440\u043d\u0438 \u0432 Python \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u041f\u0435\u0440\u0435\u0434\u0430\u0432 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 <strong>error<\/strong>:<\/p>\n\n\n\n<p><code>import math<\/code><\/p>\n\n\n\n<p><code>print(math.sqrt(-1))<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"397\" height=\"194\" src=\"https:\/\/otus.ru\/journal\/wp-content\/uploads\/2021\/05\/4-3.png\" alt=\"\" class=\"wp-image-1309\" srcset=\"https:\/\/otus.ru\/journal\/wp-content\/uploads\/2021\/05\/4-3.png 397w, https:\/\/otus.ru\/journal\/wp-content\/uploads\/2021\/05\/4-3-300x147.png 300w, https:\/\/otus.ru\/journal\/wp-content\/uploads\/2021\/05\/4-3-150x73.png 150w\" sizes=\"auto, (max-width: 397px) 100vw, 397px\" \/><\/figure>\n\n\n\n<p>\u0410 \u0432\u043e\u0442 \u0435\u0441\u043b\u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043f\u0440\u043e \u043d\u043e\u043b\u044c, \u0442\u043e \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442, \u0442\u0430\u043a \u043a\u0430\u043a \u043a\u043e\u0434 \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e. \u041e\u0434\u043d\u0430\u043a\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0442\u0443\u0442 \u043e\u0447\u0435\u0432\u0438\u0434\u0435\u043d, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0446\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u043e\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432\u0435\u0441\u044c\u043c\u0430 \u0443\u0441\u043b\u043e\u0432\u043d\u0430:<\/p>\n\n\n\n<p><code>import math<\/code><\/p>\n\n\n\n<p><code>print(math.sqrt(0))<\/code><\/p>\n\n\n\n<p><code>> 0.0<\/code><\/p>\n\n\n\n<p>\u0425\u043e\u0442\u0438\u0442\u0435 \u0437\u043d\u0430\u0442\u044c \u043e \u00ab\u041f\u0438\u0442\u043e\u043d\u0435\u00bb \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0435? \u0414\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u0443\u0440\u0441 \u0432 \u00ab\u041e\u0442\u0443\u0441\u00bb!<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/otus.ru\/lessons\/python-professional\/?utm_source=oj&amp;utm_medium=affilate&amp;utm_campaign=python\"><img loading=\"lazy\" decoding=\"async\" width=\"970\" height=\"90\" src=\"https:\/\/otus.ru\/journal\/wp-content\/uploads\/2021\/05\/Python_970x90-20219-8b1a8e.png\" alt=\"\" class=\"wp-image-1310\" srcset=\"https:\/\/otus.ru\/journal\/wp-content\/uploads\/2021\/05\/Python_970x90-20219-8b1a8e.png 970w, https:\/\/otus.ru\/journal\/wp-content\/uploads\/2021\/05\/Python_970x90-20219-8b1a8e-300x28.png 300w, https:\/\/otus.ru\/journal\/wp-content\/uploads\/2021\/05\/Python_970x90-20219-8b1a8e-150x14.png 150w, https:\/\/otus.ru\/journal\/wp-content\/uploads\/2021\/05\/Python_970x90-20219-8b1a8e-768x71.png 768w\" sizes=\"auto, (max-width: 970px) 100vw, 970px\" \/><\/a><\/figure>\n\n\n\n<p><em>\u041f\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430\u043c:<\/em><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><em>http:\/\/python-teach.ru\/python-dlya-nachinayushhih\/vychislenie-kvadratnogo-kornya-chisla-v-python\/.<\/em><\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u043a\u043e\u0440\u0435\u043d\u044c \u0432 Python, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043a\u0430\u043a\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f. \u041d\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u0431\u043e \u0432\u0441\u0435\u043c \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443. \u0415\u0441\u043b\u0438 \u043c\u044b \u0437\u043d\u0430\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u0449\u0443\u044e \u043f\u043b\u043e\u0449\u0430\u0434\u044c \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0430 \u0438 \u0445\u043e\u0442\u0438\u043c \u0443\u0437\u043d\u0430\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 \u043e\u0434\u043d\u043e\u0439 \u0435\u0433\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043b\u0438\u0431\u043e \u0436\u0435 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 2-\u043c\u044f \u0442\u043e\u0447\u043a\u0430\u043c\u0438 \u0432 \u0434\u0435\u043a\u0430\u0440\u0442\u043e\u0432\u044b\u0445 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u0445, \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u044b\u0439 \u043a\u043e\u0440\u0435\u043d\u044c. \u042d\u0442\u043e<\/p>\n","protected":false},"author":11,"featured_media":1305,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[27],"class_list":{"0":"post-1304","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-polza","8":"tag-python"},"_links":{"self":[{"href":"https:\/\/otus.ru\/journal\/wp-json\/wp\/v2\/posts\/1304","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/otus.ru\/journal\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/otus.ru\/journal\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/otus.ru\/journal\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/otus.ru\/journal\/wp-json\/wp\/v2\/comments?post=1304"}],"version-history":[{"count":2,"href":"https:\/\/otus.ru\/journal\/wp-json\/wp\/v2\/posts\/1304\/revisions"}],"predecessor-version":[{"id":1312,"href":"https:\/\/otus.ru\/journal\/wp-json\/wp\/v2\/posts\/1304\/revisions\/1312"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/otus.ru\/journal\/wp-json\/wp\/v2\/media\/1305"}],"wp:attachment":[{"href":"https:\/\/otus.ru\/journal\/wp-json\/wp\/v2\/media?parent=1304"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/otus.ru\/journal\/wp-json\/wp\/v2\/categories?post=1304"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/otus.ru\/journal\/wp-json\/wp\/v2\/tags?post=1304"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}