{"id":806,"date":"2026-03-26T21:25:17","date_gmt":"2026-03-26T17:25:17","guid":{"rendered":"https:\/\/avdeevk.ru\/?p=806"},"modified":"2026-03-26T21:28:02","modified_gmt":"2026-03-26T17:28:02","slug":"pythonmiddle-race-game","status":"publish","type":"post","link":"https:\/\/avdeevk.ru\/index.php\/2026\/03\/26\/pythonmiddle-race-game\/","title":{"rendered":"PythonMiddle: \u0418\u0433\u0440\u0430 \u00ab\u0413\u043e\u043d\u043a\u0438\u00bb"},"content":{"rendered":"\n<p>\u0418\u0442\u0430\u043a, \u0441\u0443\u0442\u044c \u0438\u0433\u0440\u044b \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432\u043d\u0430\u0447\u0430\u043b\u0435 \u043c\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0435\u043c \u0430\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u0438 (\u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e) \u0432\u044b\u0431\u0438\u0440\u0430\u044f \u0438\u0445 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f, \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u0433\u043e\u0434 \u0432\u044b\u043f\u0443\u0441\u043a\u0430, \u0441\u043d\u0430\u0431\u0436\u0430\u0435\u043c \u0438\u0445 \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u0435\u043c \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/avdeevk.ru\/wp-content\/uploads\/2026\/03\/001.png\"><img loading=\"lazy\" decoding=\"async\" width=\"898\" height=\"230\" src=\"https:\/\/avdeevk.ru\/wp-content\/uploads\/2026\/03\/001.png\" alt=\"\" class=\"wp-image-807\" srcset=\"https:\/\/avdeevk.ru\/wp-content\/uploads\/2026\/03\/001.png 898w, https:\/\/avdeevk.ru\/wp-content\/uploads\/2026\/03\/001-300x77.png 300w, https:\/\/avdeevk.ru\/wp-content\/uploads\/2026\/03\/001-768x197.png 768w\" sizes=\"auto, (max-width: 898px) 100vw, 898px\" \/><\/a><\/figure>\n\n\n\n<p>\u0417\u0430\u0442\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0435\u043c \u0434\u043b\u0438\u043d\u0443 \u0442\u0440\u0430\u0441\u0441\u044b..<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/avdeevk.ru\/wp-content\/uploads\/2026\/03\/002.png\"><img loading=\"lazy\" decoding=\"async\" width=\"937\" height=\"46\" src=\"https:\/\/avdeevk.ru\/wp-content\/uploads\/2026\/03\/002.png\" alt=\"\" class=\"wp-image-808\" srcset=\"https:\/\/avdeevk.ru\/wp-content\/uploads\/2026\/03\/002.png 937w, https:\/\/avdeevk.ru\/wp-content\/uploads\/2026\/03\/002-300x15.png 300w, https:\/\/avdeevk.ru\/wp-content\/uploads\/2026\/03\/002-768x38.png 768w\" sizes=\"auto, (max-width: 937px) 100vw, 937px\" \/><\/a><\/figure>\n\n\n\n<p>\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0437\u0430\u0435\u0437\u0434:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/avdeevk.ru\/wp-content\/uploads\/2026\/03\/003.png\"><img loading=\"lazy\" decoding=\"async\" width=\"346\" height=\"180\" src=\"https:\/\/avdeevk.ru\/wp-content\/uploads\/2026\/03\/003.png\" alt=\"\" class=\"wp-image-809\" srcset=\"https:\/\/avdeevk.ru\/wp-content\/uploads\/2026\/03\/003.png 346w, https:\/\/avdeevk.ru\/wp-content\/uploads\/2026\/03\/003-300x156.png 300w\" sizes=\"auto, (max-width: 346px) 100vw, 346px\" \/><\/a><\/figure>\n\n\n\n<p>\u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u0435\u0437\u0434\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u0438\u0448\u0435\u0442 \u043d\u0430\u043c \u0438\u0442\u043e\u0433\u043e\u0432\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/avdeevk.ru\/wp-content\/uploads\/2026\/03\/004.png\"><img loading=\"lazy\" decoding=\"async\" width=\"648\" height=\"105\" src=\"https:\/\/avdeevk.ru\/wp-content\/uploads\/2026\/03\/004.png\" alt=\"\" class=\"wp-image-810\" srcset=\"https:\/\/avdeevk.ru\/wp-content\/uploads\/2026\/03\/004.png 648w, https:\/\/avdeevk.ru\/wp-content\/uploads\/2026\/03\/004-300x49.png 300w\" sizes=\"auto, (max-width: 648px) 100vw, 648px\" \/><\/a><\/figure>\n\n\n\n<p>\u0418\u0442\u0430\u043a, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0430 \u043d\u0430 5 \u0444\u0430\u0439\u043b\u043e\u0432: Car.py, CarComponent.py, CarFabrick.py, Track.py \u0438 main.py<\/p>\n\n\n\n<p>\u0424\u0430\u0439\u043b <strong>CarComponent.py<\/strong> \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0430\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u044f. \u0423 \u043d\u0430\u0441 \u043e\u043d \u043f\u043e\u043a\u0430 \u0447\u0442\u043e \u043e\u0434\u0438\u043d &#8212; \u0414\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u044c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u0444\u0430\u0439\u043b\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0411\u0410\u0417\u041e\u0412\u042b\u0419 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 CarComponent, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u0440\u0430\u043d\u0438\u0442 \u0418\u043c\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0438 \u043c\u0435\u0442\u043e\u0434 GetName(), \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0439 \u044d\u0442\u043e \u0438\u043c\u044f \u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0440\u043e\u043a\u0438.<\/p>\n\n\n\n<p>\u0422\u0430\u043a\u0436\u0435 \u0442\u0443\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d \u043a\u043b\u0430\u0441\u0441-\u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a Engine, \u043a\u043e\u0442\u043e\u0440\u044b\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u043c CarComponent \u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 (\u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0437\u0430\u0434\u0430\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438: \u0438\u043c\u044f \u0438 \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u044c) \u0438 \u043c\u0435\u0442\u043e\u0434, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0439 \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u0442\u043e\u0440\u0430 &#8212; GetPower()<\/p>\n\n\n\n<p><strong>\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 CarComponent.py:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class CarComponent():\n    _name: str\n\n    def GetName(self):\n        return self._name\n    \nclass Engine(CarComponent):\n    def __init__(self, name, power):\n        self._name = name\n        self._power = power\n\n    def GetPower(self):\n        return self._power<\/code><\/pre>\n\n\n\n<p><strong>\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 Car.py<\/strong><\/p>\n\n\n\n<p>\u0424\u0430\u0439\u043b \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 \u0430\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u044f: \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440, \u0438 \u043c\u0435\u0442\u043e\u0434\u044b, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0430\u0432\u0442\u043e. \u0430 \u0442\u0430\u043a\u0436\u0435 2 \u043c\u0435\u0442\u043e\u0434\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0435 \u0421\u041e\u0425\u0420\u0410\u041d\u0418\u0422\u042c \u0438 \u041f\u041e\u041b\u0423\u0427\u0418\u0422\u042c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0433\u043e\u043d\u043a\u0438 \u043d\u0430 \u0442\u0440\u0435\u043a\u0435.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from CarComponent import Engine\nfrom math import pi\n\nclass Car():\n    def __init__(self, maker, model, year):\n        self._maker = maker\n        self._model = model\n        self._year = year\n        self._lastTrackResult = 0\n\n    def AddComponentsToCar(self, **components):\n        compKeys = components.keys()\n        if(\"engine\") in compKeys:\n            self._engine = components&#91;\"engine\"]\n        else:\n            raise ValueError(\"No engine!\")\n        self._speed = 2 * pi * 12 * self._engine.GetPower()\n    def GetSpeed(self):\n        return self._speed\n\n    def GetName(self):\n        return f\"\u0422\u0430\u0447\u043a\u0430: {self._maker} - {self._model} \u0413\u043e\u0434 \u0432\u044b\u043f\u0443\u0441\u043a\u0430: {self._year}\"\n\n    def GetLastTrackResult(self):\n        return self._lastTrackResult\n    \n    def SetLastTrackResult(self, result):\n        self._lastTrackResult = result<\/code><\/pre>\n\n\n\n<p><strong>\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 CarFabrick.py<\/strong><\/p>\n\n\n\n<p>\u0424\u0430\u0439\u043b \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430-\u0444\u0430\u0431\u0440\u0438\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043c &#171;\u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c&#187; \u0430\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u0438. \u0412 \u0435\u0451 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432\u0445\u043e\u0434\u0438\u0442: \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u043c\u0430\u0448\u0438\u043d, \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u043c\u043e\u0442\u043e\u0440\u043e\u0432, \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0421\u041b\u041e\u0412\u0410\u0420\u042f \u043a\u043b\u044e\u0447-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u0438\u0434\u0430  1 : {\u041c\u0430\u0440\u043a\u0430 : \u041c\u043e\u0449\u043d\u043e\u0441\u0442\u044c}<\/p>\n\n\n\n<p>2 : {\u041c\u0430\u0440\u043a\u0430 : \u041c\u043e\u0449\u043d\u043e\u0441\u0442\u044c}<\/p>\n\n\n\n<p>\u0438 \u0442.\u0434. \u0422.\u0435. \u043f\u043e \u0444\u0430\u043a\u0442\u0443 \u044d\u0442\u043e \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0441\u043b\u043e\u0432\u0430\u0440\u0435\u0439.<\/p>\n\n\n\n<p>\u0422\u0430\u043a\u0436\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u043c\u0435\u0442\u043e\u0434\u044b, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0435 \u0437\u0430 \u043f\u0435\u0447\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043a\u0430 \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u0435\u0439, \u043c\u0435\u0442\u043e\u0434, \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u044e\u0449\u0438\u0439 \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043e \u0436\u0435\u043b\u0430\u0435\u043c\u043e\u043c \u043c\u043e\u0442\u043e\u0440\u0435 \u0438 \u043c\u0435\u0442\u043e\u0434 \u0441\u043e\u0437\u0434\u0430\u044e\u0449\u0438\u0439 \u0410\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u044c, \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0432\u0432\u043e\u0434\u0430. \u0418 \u0441\u0430\u043c\u044b\u0439 \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 &#8212; \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d<\/p>\n\n\n\n<p><br><br>from Car import Car<\/p>\n\n\n\n<p>from CarComponent import Engine<\/p>\n\n\n\n<p>class CarFabrick():<br>    _cars = []<br>    _engineList = [<br>        Engine(&#171;\u0424\u043e\u0440\u0434&#187;, 1.5),<br>        Engine(&#171;\u0424\u0438\u0430\u0442&#187;, 1.4),<br>        Engine(&#171;BMW&#187;, 3.0),<br>        Engine(&#171;Lamborgini&#187;, 6.0)<br>    ]<br><br>    _engineDict = {index : value for index,value in enumerate(_engineList)}<br>    <br>    def _printEngine(self):<br>        for index,engine in self._engineDict.items():<br>            print(f&#187;{index}. \u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c: {engine.GetName()}. \u041c\u043e\u0449\u043d\u043e\u0441\u0442\u044c: {engine.GetPower()}&#187;)<br>                  <br>    def _pickEngine(self):<br>        try:<br>            indexEngine = int(input(&#171;Enter engine number: &#171;))<br>        except Exception as e:<br>            print(&#171;Wrong number! Error: &#171;,e)<br>        <br>        return self._engineDict[indexEngine]<br><br><br>    def CreateCar(self):<br>        self._printEngine()<br>        while True:<br>            print(&#171;\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0430\u0432\u0442\u043e \u2116 &#171;, len(self._cars)+1)<br>            maker = input(&#171;\u041a\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c? \u041e\u0442\u0432\u0435\u0442: &#171;)<br>            model = input(&#171;\u041a\u0430\u043a\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c? \u041e\u0442\u0432\u0435\u0442: &#171;)<br>            year = input(&#171;\u0413\u043e\u0434 \u0432\u044b\u043f\u0443\u0441\u043a\u0430:&#187;)<br>            car = Car(maker, model, year)<br>            car.AddComponentsToCar(engine = self._pickEngine())<br>            self._cars.append(car)<br><br>            userChoice = input(&#171;\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0441\u043b\u043e\u0432\u043e \\&#187;\u0412\u044b\u0445\u043e\u0434\\&#187; \u0434\u043b\u044f \u0432\u044b\u0445\u043e\u0434\u0430 \u0438\u0437 \u043a\u043e\u043d\u0441\u0442\u0443\u0440\u043a\u0442\u043e\u0440\u0430 \u0438\u043b\u0438 \u043d\u0430\u0436\u043c\u0438\u0442\u0435 Enter \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0435\u0449\u0451 \u043e\u0434\u043d\u043e\u0433\u043e \u0430\u0432\u0442\u043e&#8230;&#187;)<br>            if(userChoice.strip().lower() == &#171;\u0432\u044b\u0445\u043e\u0434&#187;):<br>                break<br>    <br>    def GetCars(self):<br>        return self._cars<\/p>\n\n\n\n<p><strong>\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 Track.py<\/strong><\/p>\n\n\n\n<p>\u041a\u043b\u0430\u0441\u0441 Track \u0441\u043e\u0434\u0435\u0436\u0438\u0442 \u0441\u0430\u043c\u0443 \u0442\u0440\u0430\u0441\u0441\u0443: \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440, \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0449\u0438\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u043c\u0430\u0448\u0438\u043d (\u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043c\u0430\u0448\u0442\u0438\u043d\u044b \u043d\u0430 \u0441\u0442\u0430\u0440\u0442) \u0438 \u0434\u043b\u0438\u043d\u0443 \u0441\u0442\u0440\u0430\u0441\u0441\u044b. \u0412\u0442\u043e\u0440\u043e\u0439 \u043c\u0435\u0442\u043e\u0434 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0441\u0430\u043c \u0437\u0430\u0435\u0437\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import time\n\nclass Track():\n    def __init__(self, length, cars):\n        self._length = length\n        self._cars = cars\n\n    def Ride(self):\n        print(\"\u041d\u0430\u0448 \u0437\u0430\u0435\u0437\u0434: \")\n        print(\"\u0423\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0438: \")\n        for car in self._cars:\n            print(car.GetName())\n        \n        print(\"\u0418\u0434\u0451\u0442 \u0437\u0430\u0435\u0437\u0434...\")\n        time.sleep(3)\n\n        print(\"...\")\n        time.sleep(2\n                   )\n        \n        for i in range(len(self._cars)):\n            self._cars&#91;i].SetLastTrackResult(self._length \/ self._cars&#91;i].GetSpeed())\n        # resultTable = sorted(self._cars, key=lambda car: self._length \/ car.GetSpeed())\n        resultTable = sorted(self._cars, key=lambda car: (car.SetLastTrackResult(self._length \/ car.GetSpeed()), self._length \/ car.GetSpeed())  )\n\n        print(\"\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0437\u0430\u0435\u0437\u0434\u0430: \")\n        for i in range(len(resultTable)):\n            print(f\"{i+1} \u043c\u0435\u0441\u0442\u043e: {resultTable&#91;i].GetName()} \u0412\u0440\u0435\u043c\u044f: {resultTable&#91;i].GetLastTrackResult()}\")<\/code><\/pre>\n\n\n\n<p><strong>\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 main.py<\/strong><\/p>\n\n\n\n<p>\u0412\u0441\u0435 \u0444\u0430\u0439\u043b\u044b \u0434\u043e \u044d\u0442\u043e\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043d\u0435 \u043d\u0430\u0447\u043d\u0451\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u043c\u044b \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u043b\u0438\u043c \u043d\u0443\u0436\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430\u043c\u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0438 \u043d\u0435 \u0432\u044b\u0437\u043e\u0432\u0435\u043c \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u043c\u0435\u0442\u043e\u0434\u044b \u044d\u0442\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u0427\u0435\u043c \u043c\u044b \u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u043c\u0441\u044f \u0432 \u0444\u0430\u0439\u043b\u0435 main,py<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from Track import Track\nfrom CarFabric import CarFabrick\n\ncarFab = CarFabrick() #\u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0444\u0430\u0431\u0440\u0438\u043a\u0443 \u043c\u0430\u0448\u0438\u043d\ncarFab.CreateCar() # \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043c\u0430\u0448\u0438\u043d\u044b, \u043e\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\ntLength = 1000 # \u0414\u043b\u0438\u043d\u0430 \u0442\u0440\u0430\u0441\u0441\u044b \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0435\u0441\u043b\u0438 \u0432\u0432\u043e\u0434 \u0434\u043b\u0438\u043d\u044b \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0439\ntry:\n    tLength = int(input(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0434\u043b\u0438\u043d\u0443 \u0442\u0440\u0430\u0441\u0441\u044b, \u043c\u0435\u0442\u0440\u044b: \"))\nexcept:\n    print(\"\u041d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0432\u0432\u043e\u0434! \u041f\u043e\u0435\u0434\u0435\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u0442\u0440\u0430\u0441\u0441\u0443 1000 \u043c\") # \u0412\u043e\u0442 \u043a\u0430\u043a \u0440\u0430\u0437 \u043d\u0430 \u044d\u0442\u043e\u0442 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439!\n\n\ntrack = Track(tLength, carFab.GetCars()) # \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0422\u0440\u0430\u0441\u0441\u0443\ntrack.Ride() # \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0433\u043e\u043d\u043a\u0443<\/code><\/pre>\n\n\n\n<p>\u0412 \u0446\u0435\u043b\u043e\u043c \u0432\u043e\u0442 \u0442\u0430\u043a\u0430\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043a\u0430. \u0412\u043e\u043f\u0440\u043e\u0441\u044b \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 myClass.team<\/p>\n\n\n\n<p>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432 VSCode \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/avdeevk.ru\/wp-content\/uploads\/2026\/03\/005.png\"><img loading=\"lazy\" decoding=\"async\" width=\"381\" height=\"157\" src=\"https:\/\/avdeevk.ru\/wp-content\/uploads\/2026\/03\/005.png\" alt=\"\" class=\"wp-image-813\" srcset=\"https:\/\/avdeevk.ru\/wp-content\/uploads\/2026\/03\/005.png 381w, https:\/\/avdeevk.ru\/wp-content\/uploads\/2026\/03\/005-300x124.png 300w\" sizes=\"auto, (max-width: 381px) 100vw, 381px\" \/><\/a><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0418\u0442\u0430\u043a, \u0441\u0443\u0442\u044c \u0438\u0433\u0440\u044b \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432\u043d\u0430\u0447\u0430\u043b\u0435 \u043c\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0435\u043c \u0430\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u0438 (\u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e) \u0432\u044b\u0431\u0438\u0440\u0430\u044f \u0438\u0445 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f, \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u0433\u043e\u0434 \u0432\u044b\u043f\u0443\u0441\u043a\u0430, \u0441\u043d\u0430\u0431\u0436\u0430\u0435\u043c \u0438\u0445 \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u0435\u043c \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430. \u0417\u0430\u0442\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0435\u043c \u0434\u043b\u0438\u043d\u0443 \u0442\u0440\u0430\u0441\u0441\u044b.. \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0437\u0430\u0435\u0437\u0434: \u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u0435\u0437\u0434\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u0438\u0448\u0435\u0442 \u043d\u0430\u043c \u0438\u0442\u043e\u0433\u043e\u0432\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430. \u0418\u0442\u0430\u043a, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0430 \u043d\u0430 5 \u0444\u0430\u0439\u043b\u043e\u0432: Car.py, CarComponent.py, CarFabrick.py, Track.py \u0438 main.py \u0424\u0430\u0439\u043b CarComponent.py \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[30,31,1,12],"tags":[],"class_list":["post-806","post","type-post","status-publish","format-standard","hentry","category-topit","category-topit-tuts","category-without-column","category-tuts"],"_links":{"self":[{"href":"https:\/\/avdeevk.ru\/index.php\/wp-json\/wp\/v2\/posts\/806","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/avdeevk.ru\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/avdeevk.ru\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/avdeevk.ru\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/avdeevk.ru\/index.php\/wp-json\/wp\/v2\/comments?post=806"}],"version-history":[{"count":3,"href":"https:\/\/avdeevk.ru\/index.php\/wp-json\/wp\/v2\/posts\/806\/revisions"}],"predecessor-version":[{"id":815,"href":"https:\/\/avdeevk.ru\/index.php\/wp-json\/wp\/v2\/posts\/806\/revisions\/815"}],"wp:attachment":[{"href":"https:\/\/avdeevk.ru\/index.php\/wp-json\/wp\/v2\/media?parent=806"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/avdeevk.ru\/index.php\/wp-json\/wp\/v2\/categories?post=806"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/avdeevk.ru\/index.php\/wp-json\/wp\/v2\/tags?post=806"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}