{"id":683,"date":"2021-07-06T11:41:23","date_gmt":"2021-07-06T11:41:23","guid":{"rendered":"https:\/\/www.bearloga.space\/?page_id=683"},"modified":"2021-07-06T11:41:24","modified_gmt":"2021-07-06T11:41:24","slug":"python-urok-8-matriczy-dvumernyj-massiv","status":"publish","type":"page","link":"https:\/\/www.bearloga.space\/uk\/python-urok-8-matriczy-dvumernyj-massiv\/","title":{"rendered":"Python \u0423\u0440\u043e\u043a 8. \u041c\u0430\u0442\u0440\u0438\u0446\u044b (\u0434\u0432\u0443\u043c\u0435\u0440\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432)"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u041d\u0430 \u0443\u0440\u043e\u043a\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u044b\u043c\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c\u0438 \u0432 Python: \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b, \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0432\u044b\u0432\u043e\u0434, \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u0430\u0442\u0440\u0438\u0446\u044b<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435, \u0432\u044b\u0432\u043e\u0434 \u0438 \u0432\u0432\u043e\u0434 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0432 \u041f\u0438\u0442\u043e\u043d\u0435<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0438\u0437 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0441\u043f\u0438\u0441\u043a\u043e\u0432, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0440\u043e\u043a \u043c\u0430\u0442\u0440\u0438\u0446\u044b, \u0430 \u0447\u0438\u0441\u043b\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u0435.<\/li><li><strong>\u0412\u044b\u0432\u043e\u0434 \u043c\u0430\u0442\u0440\u0438\u0446\u044b<\/strong>&nbsp;\u043c\u043e\u0436\u043d\u043e \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u0442\u044c \u043e\u0434\u043d\u0438\u043c \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c, \u043d\u043e \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432:<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<br>&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/labs-org.ru\/wp-content\/uploads\/509.png\" alt=\"\u0432\u044b\u0432\u043e\u0434 \u043c\u0430\u0442\u0440\u0438\u0446\u044b\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u0414\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0432 \u0432\u0438\u0434\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u0443\u044e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>\u0441\u043f\u043e\u0441\u043e\u0431:<\/li><\/ol>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1 <br>2 <br>3 <br>4 <br>5<\/td><td><strong><strong>def<\/strong> printMatrix ( matrix ):<\/strong><br><strong> <strong>for<\/strong> i <strong>in<\/strong> range ( len(matrix) ):<\/strong><br><strong> <strong>for<\/strong> j <strong>in<\/strong> range ( len(matrix[i]) ):<\/strong><br><strong> <strong>print<\/strong> ( &#8220;{:4d}&#8221;.format(matrix[i][j]), end = &#8220;&#8221; ) <\/strong><br><strong><strong>print<\/strong> ()<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<ol class=\"wp-block-list\"><li>2 \u0441\u043f\u043e\u0441\u043e\u0431<\/li><\/ol>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1 <br>2 <br>3 <br>4 <br>5<\/td><td><strong><strong>def<\/strong> printMatrix ( matrix ): <\/strong><br><strong><strong>for<\/strong> row <strong>in<\/strong> matrix: <\/strong><br><strong><strong>for<\/strong> x <strong>in<\/strong> row: <\/strong><br><strong><strong>print<\/strong> ( &#8220;{:4d}&#8221;.format(x), end = &#8220;&#8221; )<\/strong><br><strong> <strong>print<\/strong> ()<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0414\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u0430\u0442\u0440\u0438\u0446\u044b<\/strong>&nbsp;\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1 <br>2 <br>3 <br>4<\/td><td><strong>from<\/strong> random <strong>import<\/strong> randint n, m = 3, 3 a = [[randint(1, 10)<br> <strong>for<\/strong> j <strong>in<\/strong> range(m)] <br><strong>for<\/strong> i <strong>in<\/strong> range(n)]<br> <strong>print<\/strong>(a)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u041d\u0443\u043c\u0435\u0440\u0430\u0446\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u043a\u0430\u043a \u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u043d\u0443\u043b\u044f.<br>\u0422.\u0435.&nbsp;<code>matrix[2][3]<\/code>&nbsp;\u2014 \u044d\u0442\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0442\u0440\u0435\u0442\u044c\u0435\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u043e\u0433\u043e \u0441\u0442\u043e\u043b\u0431\u0446\u0430.<strong>\u041f\u0440\u0438\u043c\u0435\u0440 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u0430\u0442\u0440\u0438\u0446\u044b:<\/strong><br>\u041d\u0430\u0439\u0442\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#x270d; \u0420\u0435\u0448\u0435\u043d\u0438\u0435:<br>&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1<br>2 <br>3 <br>4 <br>5<\/td><td>p = 1<br><strong>for<\/strong> i <strong>in<\/strong> range(N): <br><strong>for<\/strong> j <strong>in<\/strong> range(M): <br>p *= matrix[i][j] <br><strong>print<\/strong> (p)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u041f\u0440\u0438\u043c\u0435\u0440:<\/strong><br>\u041d\u0430\u0439\u0442\u0438 \u0441\u0443\u043c\u043c\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#x270d; \u0420\u0435\u0448\u0435\u043d\u0438\u0435:<br>&nbsp;\u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0434\u043b\u044f Python:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1 <br>2 <br>3 <br>4<\/td><td>s = 0 <br><strong>for<\/strong> row <strong>in<\/strong> matrix:<br> s += sum(row) <br><strong>print<\/strong> (s)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u0414\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0441\u0443\u043c\u043c\u044b \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f&nbsp;<strong>sum<\/strong>.<strong>\u0417\u0430\u0434\u0430\u043d\u0438\u0435 Python 8_0:<\/strong><br>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u044b \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u0432\u043e\u0437\u0434\u0443\u0445\u0430 \u0437\u0430 4 \u0434\u043d\u044f \u0441 \u0442\u0440\u0435\u0445 \u043c\u0435\u0442\u0435\u043e\u0441\u0442\u0430\u043d\u0446\u0438\u0439, \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0440\u0435\u0433\u0438\u043e\u043d\u0430\u0445 \u0441\u0442\u0440\u0430\u043d\u044b:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>\u041d\u043e\u043c\u0435\u0440 \u0441\u0442\u0430\u043d\u0446\u0438\u0438<\/th><th>1-\u0439 \u0434\u0435\u043d\u044c<\/th><th>2-\u0439 \u0434\u0435\u043d\u044c<\/th><th>3-\u0439 \u0434\u0435\u043d\u044c<\/th><th>4-\u0439 \u0434\u0435\u043d\u044c<\/th><\/tr><tr><td>1<\/td><td>-8<\/td><td>-14<\/td><td>-19<\/td><td>-18<\/td><\/tr><tr><td>2<\/td><td>25<\/td><td>28<\/td><td>26<\/td><td>20<\/td><\/tr><tr><td>3<\/td><td>11<\/td><td>18<\/td><td>20<\/td><td>25<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u0422.\u0435. \u0437\u0430\u043f\u0438\u0441\u044c \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0438\u0439 \u0432 \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u043e\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u0430 \u0431\u044b \u0442\u0430\u043a:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>t[0][0]=-8<\/td><td>t[0][1]=-14<\/td><td>t[0][2]=-19<\/td><td>t[0][3]=-18<\/td><\/tr><tr><td>t[1][0]=25<\/td><td>t[1][1]=28<\/td><td>t[1][2]=26<\/td><td>t[1][3]=20<\/td><\/tr><tr><td>t[2][0]=11<\/td><td>t[2][1]=18<\/td><td>t[2][2]=20<\/td><td>t[2][3]=25<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<ol class=\"wp-block-list\"><li>\u0420\u0430\u0441\u043f\u0435\u0447\u0430\u0442\u0430\u0442\u044c \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0443 \u043d\u0430 2-\u0439 \u043c\u0435\u0442\u0435\u043e\u0441\u0442\u0430\u043d\u0446\u0438\u0438 \u0437\u0430 4-\u0439 \u0434\u0435\u043d\u044c \u0438 \u043d\u0430 3-\u0439 \u043c\u0435\u0442\u0435\u043e\u0441\u0442\u0430\u043d\u0446\u0438\u0438 \u0437\u0430 1-\u0439 \u0434\u0435\u043d\u044c.<\/li><li>\u0420\u0430\u0441\u043f\u0435\u0447\u0430\u0442\u0430\u0442\u044c \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0442\u0435\u0440\u043c\u043e\u043c\u0435\u0442\u0440\u043e\u0432 \u0432\u0441\u0435\u0445 \u043c\u0435\u0442\u0435\u043e\u0441\u0442\u0430\u043d\u0446\u0438\u0439 \u0437\u0430 2-\u0439 \u0434\u0435\u043d\u044c.<\/li><li>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u0440\u0435\u0434\u043d\u044e\u044e \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0443 \u043d\u0430 3-\u0439 \u043c\u0435\u0442\u0435\u043e\u0441\u0442\u0430\u043d\u0446\u0438\u0438.<\/li><li>\u0420\u0430\u0441\u043f\u0435\u0447\u0430\u0442\u0430\u0442\u044c, \u0432 \u043a\u0430\u043a\u0438\u0435 \u0434\u043d\u0438 \u0438 \u043d\u0430 \u043a\u0430\u043a\u0438\u0445 \u043c\u0435\u0442\u0435\u043e\u0441\u0442\u0430\u043d\u0446\u0438\u044f\u0445 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u0431\u044b\u043b\u0430 \u0432 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 24-26 \u0433\u0440\u0430\u0434\u0443\u0441\u043e\u0432 \u0442\u0435\u043f\u043b\u0430.<\/li><\/ol>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0417\u0430\u0434\u0430\u043d\u0438\u0435 Python 8_1:<\/strong><br>\u041d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u043f\u043e\u0438\u0441\u043a\u0430 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0438 \u0438\u0445 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432.<strong>\u0417\u0430\u0434\u0430\u043d\u0438\u0435 Python 8_2:<\/strong><br>\u041d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u0432\u044b\u0432\u043e\u0434\u044f\u0449\u0443\u044e \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u0441\u0442\u0440\u043e\u043a\u0443 \u043c\u0430\u0442\u0440\u0438\u0446\u044b, \u0441\u0443\u043c\u043c\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430.\u0414\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b (\u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c N x N):\u0414\u043b\u044f&nbsp;<strong>\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u0438<\/strong>&nbsp;\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u0446\u0438\u043a\u043b:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>for<\/strong> i <strong>in<\/strong> range(N): <em># \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 matrix[i][i]<\/em><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u0414\u043b\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u043e\u0431\u043e\u0447\u043d\u043e\u0439 \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u0438:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>for<\/strong> i <strong>in<\/strong> range(N): <em># \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 matrix[i][N-1-i]<\/em><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u041f\u0440\u0438\u043c\u0435\u0440:<\/strong>\u041f\u0435\u0440\u0435\u0441\u0442\u0430\u0432\u0438\u0442\u044c 2-\u0439 \u0438 4-\u0439 \u0441\u0442\u043e\u043b\u0431\u0446\u044b \u043c\u0430\u0442\u0440\u0438\u0446\u044b. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0432\u0430 \u0441\u043f\u043e\u0441\u043e\u0431\u0430.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#x270d; \u0420\u0435\u0448\u0435\u043d\u0438\u0435:<br>&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">1.<strong>for<\/strong> i <strong>in<\/strong> range(N): \n  c = A[i][2] \n  A[i][2] = A[i][4] \n  A[i][4] = c\n\n\n2.<strong>for<\/strong> i <strong>in<\/strong> range(N): \n A[i][2], A[i][4] = A[i][4], A[i][2]<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0417\u0430\u0434\u0430\u043d\u0438\u0435 Python 8_3:<\/strong><br>\u0421\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0443\u044e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c\u044e N. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c:\u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u043b\u0435\u0436\u0430\u0449\u0438\u0439 \u043d\u0438\u0436\u0435 \u043f\u043e\u0431\u043e\u0447\u043d\u043e\u0439 \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u0438;\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043d\u0435\u043d\u0443\u043b\u0435\u0432\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0441\u0442\u0440\u043e\u043a\u0438.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041d\u0430 \u0443\u0440\u043e\u043a\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u044b\u043c\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c\u0438 \u0432 Python: \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b, \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0432\u044b\u0432\u043e\u0434, \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435, \u0432\u044b\u0432\u043e\u0434 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-683","page","type-page","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/pages\/683","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/comments?post=683"}],"version-history":[{"count":0,"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/pages\/683\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/media?parent=683"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/categories?post=683"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/tags?post=683"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}