{"id":307099,"date":"2020-07-17T15:00:22","date_gmt":"2020-07-17T15:00:22","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=307099"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=307099","title":{"rendered":"\u041a\u0430\u043a \u044f \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b 30$ \u043d\u0430 \u0441\u0442\u0430\u0432\u043a\u0430\u0445 \u043d\u0430 \u0441\u043f\u043e\u0440\u0442"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/511456\/\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043a\u0430\u043a \u044f \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u043d\u0430 \u0441\u0442\u0430\u0432\u043a\u0430\u0445 \u043d\u0430 \u0441\u043f\u043e\u0440\u0442, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Python \u0438 \u0431\u0430\u0437\u043e\u0432\u0443\u044e \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0443. \u041a\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u0434\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434 \u043a\u0430\u0442!<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/9c2\/ea0\/a6e\/9c2ea0a6e133cba678699bacabe144ce.png\" alt=\"1\"><\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2>\u0411\u0443\u043a\u043c\u0435\u043a\u0435\u0440\u0441\u043a\u0430\u044f \u0432\u0438\u043b\u043a\u0430<\/h2>\n<p>  <\/p>\n<p>\u0415\u0441\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0442\u0435\u0440\u043c\u0438\u043d \u0432 \u0441\u0442\u0430\u0432\u043a\u0430\u0445 \u043d\u0430 \u0441\u043f\u043e\u0440\u0442 \u043a\u0430\u043a \u0431\u0443\u043a\u043c\u0435\u043a\u0435\u0440\u0441\u043a\u0430\u044f \u0432\u0438\u043b\u043a\u0430. \u0411\u0443\u043a\u043c\u0435\u043a\u0435\u0440\u0441\u043a\u0430\u044f \u0432\u0438\u043b\u043a\u0430 \u2014 \u044d\u0442\u043e \u0442\u0430\u043a\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u0432 \u0432 \u0434\u0432\u0443\u0445 \u0438\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u043d\u0442\u043e\u0440\u0430\u0445 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e \u0441\u0442\u0430\u0432\u043a\u0435 \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0432\u0437\u0430\u0438\u043c\u043e\u0438\u0441\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0438\u0439 \u0438\u0441\u0445\u043e\u0434 \u0443 \u0440\u0430\u0437\u043d\u044b\u0445 \u0431\u0443\u043a\u043c\u0435\u043a\u0435\u0440\u043e\u0432 \u0438 \u043e\u0441\u0442\u0430\u0442\u044c\u0441\u044f \u0432 \u043f\u0440\u0438\u0431\u044b\u043b\u0438 \u043f\u0440\u0438 \u043b\u044e\u0431\u043e\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435. \u041a\u0430\u043a \u0440\u0430\u0437 \u0442\u0430\u043a\u0438 \u043f\u043e\u0438\u0441\u043a\u043e\u043c \u044d\u0442\u0438\u0445 \u0432\u0438\u043b\u043e\u043a \u043c\u044b \u0438 \u0437\u0430\u0439\u043c\u0451\u043c\u0441\u044f .<\/p>\n<p>  <\/p>\n<h2>\u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442?<\/h2>\n<p>  <\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u0435\u043d\u043d\u0438\u0441\u043d\u044b\u0439 \u043c\u0430\u0442\u0447, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u043b 16.07 \u043c\u0435\u0436\u0434\u0443 \u041c\u0430\u0442\u0443\u0441\u0435\u0432\u0438\u0447\u0435\u043c \u0410. \u0438 \u041f\u044d\u0440\u0438\u0441\u043e\u043c \u0414\u0436. \u0412\u043e\u0442 \u043a\u0430\u043a\u0438\u0435 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u043b\u0430 \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u0430\u0442\u0447 \u043a\u043e\u043d\u0442\u043e\u0440\u0430 <a href=\"https:\/\/www.marathonbet.by\/\" rel=\"nofollow\">marathonbet<\/a>:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/ef4\/9d1\/024\/ef49d102487a7da67868c19e8577aacd.png\" alt=\"2\"><\/p>\n<p>  <\/p>\n<p>\u0410 \u0432\u043e\u0442 \u043a\u0430\u043a\u0438\u0435 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u0431\u044b\u043b\u0438 \u0432 \u043a\u043e\u043d\u0442\u043e\u0440\u0435 <a href=\"http:\/\/plusminus.by\/\" rel=\"nofollow\">plusminus<\/a>:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/1f4\/22e\/f2b\/1f422ef2b933c2b8ac135941336a3f0a.png\" alt=\"3\"><\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u0438\u043b\u043a\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e: \u0435\u0441\u043b\u0438 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 1\/K1 +1\/K2 \u043c\u0435\u043d\u044c\u0448\u0435 1, \u0442\u043e \u0432\u0438\u043b\u043a\u0430 \u0435\u0441\u0442\u044c, \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0432\u0438\u043b\u043a\u0438 \u043d\u0435\u0442, \u0433\u0434\u0435<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">K1 - \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0438\u0441\u0445\u043e\u0434 \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u043a\u043e\u043d\u0442\u043e\u0440\u0435 K2 - \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u043d\u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u0438\u0441\u0445\u043e\u0434 \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u043a\u043e\u043d\u0442\u043e\u0440\u0435.  \u0420\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f. \u0415\u0441\u043b\u0438 \u043c\u044b \u0432 \u043a\u043e\u043d\u0442\u043e\u0440\u0435  marathonbet \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043c \u043d\u0430 \u041c\u0430\u0442\u0443\u0441\u0435\u0432\u0438\u0447\u0430, \u0430 \u0432 plusminus \u043d\u0430 \u041f\u044d\u0440\u0438\u0441\u0430, \u0442\u043e \u0432\u0438\u043b\u043a\u0438 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442, \u0442\u0430\u043a \u043a\u0430\u043a 1\/1.125+ 1\/3.92 = 1.1439909297052153. \u0410 \u0435\u0441\u043b\u0438 \u043c\u044b \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043c \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442, \u0442\u043e: 1\/5.7 + 1\/1.24 = 0.9818902093944539 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u0435\u0442, \u0447\u0442\u043e \u0432\u0438\u043b\u043a\u0430 \u0435\u0441\u0442\u044c.<\/code><\/pre>\n<p>  <\/p>\n<h2>\u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0430\u0432\u0438\u0442\u044c?<\/h2>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0432\u0438\u043b\u043a\u0430 \u0431\u044b\u043b\u0430 \u043d\u0430\u0439\u0434\u0435\u043d\u0430, \u0432\u0441\u0442\u0430\u0451\u0442 \u0432\u043e\u043f\u0440\u043e\u0441: \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0430\u0432\u0438\u0442\u044c? \u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0444\u043e\u0440\u043c\u0443\u043b\u043e\u0439:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">summa_min = (K1 x summa_max)\/K2, \u0433\u0434\u0435 K1&lt;K2; summa_max \u2014 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0443\u043c\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432 \u043e\u0434\u043d\u043e\u0439 \u043a\u043e\u043d\u0442\u043e\u0440\u0435; summa_min \u2014 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0443\u043c\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u043a\u043e\u043d\u0442\u043e\u0440\u0435. <\/code><\/pre>\n<p>  <\/p>\n<p>\u0420\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f. \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0443\u043c\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0433\u043e\u0442\u043e\u0432\u044b \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 100$, \u0442\u043e\u0433\u0434\u0430 summa_min = ( 1.24 x100)\/5.7; summa_min = 21.75438596491228$. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043d\u0430 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 5.7 \u0441\u0442\u0430\u0432\u0438\u043c 21.75438596491228$, \u0430 \u043d\u0430 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 1.24 \u0441\u0442\u0430\u0432\u0438\u043c 100$, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0447\u0438\u0441\u0442\u044b\u0439 \u0432\u044b\u0438\u0433\u0440\u044b\u0448 \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u0442 2.2456140350877263$. \u0415\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, 21.75438596491228$ \u0432\u044b \u043d\u0435 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u0435, \u0434\u0430 \u0438 \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u043a\u0440\u0443\u0433\u043b\u0438\u0442\u044c \u0434\u043e \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0435\u0433\u043e \u0446\u0435\u043b\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430.<\/p>\n<p>  <\/p>\n<h2>\u041f\u0440\u0430\u043a\u0442\u0438\u043a\u0430<\/h2>\n<p>  <\/p>\n<p>\u0427\u0442\u043e \u0436, \u0442\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0430\u0441\u043f\u0435\u043a\u0442\u044b \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u044b, \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0442\u0435 \u0441\u0430\u043c\u044b\u0435 \u0432\u0438\u043b\u043a\u0438. \u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">import requests from bs4 import BeautifulSoup from difflib import SequenceMatcher from collections import defaultdict<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c html-\u043a\u043e\u0434 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">def get_html(url):     r = requests.get(url)     return r.text<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u0433\u0440\u043e\u043a\u043e\u0432 \u0438 \u0438\u0445 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u0432\u0441\u0435\u0445 \u0442\u0435\u043d\u043d\u0438\u0441\u043d\u044b\u0445 \u043c\u0430\u0442\u0447\u0435\u0439 \u0432 \u0431\u0443\u043a\u043c\u0435\u043a\u0435\u0440\u0441\u043a\u043e\u0439 \u043a\u043e\u043d\u0442\u043e\u0440\u0435 marathonbet: <\/p>\n<p>  <\/p>\n<pre><code class=\"python\">def get_all_event_marathonbet(html):     all_players = []     all_K = []     soup = BeautifulSoup(html, 'lxml')     all_event = soup.find('div',     class_ = &quot;sport-category-content&quot;).find_all('div',                                 class_='bg coupon-row')     for players in all_event:         players = players['data-event-name'].\\             replace('- ', '.').split('.')         player_1 = players[1].strip()         player_2 = players[3].strip()         all_players.append(player_1)         all_players.append(player_2)      for g in all_event:         K1 = g.find('td',colspan=&quot;1&quot;).find('span',         class_=&quot;selection-link active-selection&quot;).text         K2 = g.find('td', colspan=&quot;1&quot;).find('span',         class_=&quot;selection-link active-selection&quot;).\\             findNext('span').text         all_K.append(K1)         all_K.append(K2)      return all_players, all_K<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u0433\u0440\u043e\u043a\u043e\u0432 \u0438 \u0438\u0445 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u0431\u0443\u043a\u043c\u0435\u043a\u0435\u0440\u0441\u043a\u043e\u0439 \u043a\u043e\u043d\u0442\u043e\u0440\u0435, \u043a\u043e\u0434 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u043d\u0430 <a href=\"https:\/\/github.com\/wb-08\/BK\" rel=\"nofollow\">github<\/a>. \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 \u0438\u0433\u0440\u043e\u043a\u043e\u0432 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u043f\u0430\u0440\u044b, \u0442\u043e \u0435\u0441\u0442\u044c \u0441\u0430\u043c\u0438 \u043c\u0430\u0442\u0447\u0438: <\/p>\n<p>  <\/p>\n<pre><code class=\"python\">def create_arr_couple(arr_players):     arr_couple = []     for i in range(0, len(arr_players), 2):         arr_couple.append(arr_players[i] + ' V '                           + arr_players[i + 1])     return arr_couple<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0432\u0438\u0434\u0430: {&#8216;\u041c\u0430\u0442\u0443\u0441\u0435\u0432\u0438\u0447 V \u041f\u044d\u0440\u0438\u0441&#8217;: [&#8216;1.24&#8217;, &#8216;3.92&#8217;]}. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">def create_dict(arr_couple, arr_key):     cat = defaultdict(list)     scet = 0     try:         for i in range(len(arr_couple)):             cat[arr_couple[i]].append(arr_key[scet])             cat[arr_couple[i]].append(arr_key[scet + 1])             scet += 2         return dict(cat)     except IndexError:         print('ERROR!') <\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c 4 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435:<br \/>  1) \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u043e\u0431\u0449\u0438\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u043a\u043e\u043d\u0442\u043e\u0440\u0430\u043c\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">def similar(a, b):     return SequenceMatcher(None, a, b).ratio()<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0430\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0447\u0438\u0441\u043b\u043e \u043e\u0442 0 \u0434\u043e 1, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0430 \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u0434\u0440\u0443\u0433\u0443\u044e, \u0442\u0430\u043a \u043a\u0430\u043a \u0431\u044b\u0432\u0430\u044e\u0442 \u0442\u0430\u043a\u0438\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u0447\u0442\u043e \u0444\u0430\u043c\u0438\u043b\u0438\u044e \u043e\u0434\u043d\u043e\u0433\u043e \u0438 \u0442\u043e\u0433\u043e \u0436\u0435 \u0438\u0433\u0440\u043e\u043a\u0430 \u043c\u043e\u0433\u0443\u0442 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u043a\u043e\u043d\u0442\u043e\u0440\u0430\u0445 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043e-\u0440\u0430\u0437\u043d\u043e\u043c\u0443. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0444\u0430\u043c\u0438\u043b\u0438\u044e Sarmiento \u0432 \u043e\u0434\u043d\u043e\u0439 \u043a\u043e\u043d\u0442\u043e\u0440\u0435 \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0442\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u043a\u0430\u043a \u0421\u0430\u0440\u043c\u044c\u0435\u043d\u0442\u043e, \u0430 \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u043a\u0430\u043a \u0421\u0430\u0440\u043c\u0438\u0435\u043d\u0442\u043e. <\/p>\n<p>  <\/p>\n<p>2) \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u0441\u0443\u043c\u043c\u0443 1\/K1 +1\/K2 :<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">def find_vilka(K1, K2):     return 1\/float(K1)+1\/float(K2)<\/code><\/pre>\n<p>  <\/p>\n<p>3) \u0441\u0447\u0438\u0442\u0430\u0435\u0442, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u0442 \u0447\u0438\u0441\u0442\u044b\u0439 \u0432\u044b\u0438\u0433\u0440\u044b\u0448:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">def profit(K, summa_max,summa_min):     print(&quot;\u0412\u044b\u0438\u0433\u0440\u044b\u0448 \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u0442: &quot;+           str((float(K)*summa_max)-summa_min-summa_max))<\/code><\/pre>\n<p>  <\/p>\n<p>4) \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438 \u043d\u0430 \u043a\u0430\u043a\u043e\u0439 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u043d\u0443\u0436\u043d\u043e \u0441\u0442\u0430\u0432\u0438\u0442\u044c:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">def raschet_vilki(K1,K2,summa_max = 100):      if K1&lt;K2:         summa_min = (float(K1)*summa_max)\/float(K2)         print('\u041d\u0430 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 {}'.format(K1)+               ' \u0441\u0442\u0430\u0432\u0438\u043c {} '.format(summa_max))         print('\u041d\u0430 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 {}'.format(K2) +                ' \u0441\u0442\u0430\u0432\u0438\u043c {} '.format(summa_min))          profit(K1, summa_max, summa_min)      else:         summa_min = (float(K2) * summa_max) \/ float(K1)         print('\u041d\u0430 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 {}'.format(K1) +                ' \u0441\u0442\u0430\u0432\u0438\u043c {} '.format(summa_min))         print('\u041d\u0430 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 {}'.format(K2) +                ' \u0441\u0442\u0430\u0432\u0438\u043c {} '.format(summa_max))          profit(K2, summa_max, summa_min)<\/code><\/pre>\n<p>  <\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0443\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0447\u0435\u043c \u0437\u0430 \u043c\u0435\u0441\u044f\u0446 \u043c\u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c 30$ \u043f\u0440\u0438 \u0432\u043b\u043e\u0436\u0435\u043d\u0438\u0438 120$. \u0414\u0430, \u044d\u0442\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e, \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044f, \u0447\u0442\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0431\u044b\u043b\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u0434\u043b\u044f \u0434\u0432\u0443\u0445 \u0431\u0443\u043a\u043c\u0435\u043a\u0435\u0440\u0441\u043a\u0438\u0445 \u043a\u043e\u043d\u0442\u043e\u0440, \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0442\u0435\u043d\u043d\u0438\u0441\u0430 \u0438 \u044f \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043b \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u043d\u0430 \u043c\u0430\u0442\u0447\u0438 3-5 \u0440\u0430\u0437 \u0432 \u0441\u0443\u0442\u043a\u0438. \u0412 \u0441\u0440\u0435\u0434\u043d\u0435\u043c, \u0432 \u0434\u0435\u043d\u044c \u0443\u0434\u0430\u0432\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u043f\u043e \u0434\u0432\u0435 \u0432\u0438\u043b\u043a\u0438. \u0412 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c, \u043f\u043e\u043f\u0430\u0434\u0430\u043b\u0438\u0441\u044c \u0432\u0438\u043b\u043a\u0438 \u043e\u0442 0. 97 \u0438 \u0432\u044b\u0448\u0435, \u0447\u0442\u043e \u043f\u0440\u0438\u043d\u043e\u0441\u0438\u043b\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043b\u0438\u0448\u044c \u043f\u0430\u0440\u0443 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u043e\u0432 \u043e\u0442 \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e.<\/p>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/511456\/\"> https:\/\/habr.com\/ru\/post\/511456\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/511456\/\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043a\u0430\u043a \u044f \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u043d\u0430 \u0441\u0442\u0430\u0432\u043a\u0430\u0445 \u043d\u0430 \u0441\u043f\u043e\u0440\u0442, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Python \u0438 \u0431\u0430\u0437\u043e\u0432\u0443\u044e \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0443. \u041a\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u0434\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434 \u043a\u0430\u0442!<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/9c2\/ea0\/a6e\/9c2ea0a6e133cba678699bacabe144ce.png\" alt=\"1\"><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-307099","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/307099","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=307099"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/307099\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=307099"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=307099"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=307099"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}