From f7772b96c98bca941f3578df193d8c1523435bdf Mon Sep 17 00:00:00 2001 From: Home Date: Mon, 13 Oct 2025 23:04:03 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=B7=201?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- homework_01/homework_01.ipynb | 248 ++++++++++++++++++++++++++++++---- 1 file changed, 223 insertions(+), 25 deletions(-) diff --git a/homework_01/homework_01.ipynb b/homework_01/homework_01.ipynb index 48efeea..c750bc9 100644 --- a/homework_01/homework_01.ipynb +++ b/homework_01/homework_01.ipynb @@ -27,13 +27,30 @@ }, { "cell_type": "code", - "execution_count": null, "id": "5a4d665d", - "metadata": {}, - "outputs": [], + "metadata": { + "ExecuteTime": { + "end_time": "2025-10-13T18:33:35.885424Z", + "start_time": "2025-10-13T18:33:33.272009Z" + } + }, "source": [ - "# ВАШ КОД ЗДЕСЬ" - ] + "input_text = input(\"Введите пятизначное число\")\n", + "\n", + "result = input_text[0] + input_text[3] + input_text[2] + input_text[1] + input_text[4]\n", + "\n", + "print(result)" + ], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "14325\n" + ] + } + ], + "execution_count": 5 }, { "cell_type": "markdown", @@ -54,13 +71,40 @@ }, { "cell_type": "code", - "execution_count": null, "id": "07154103", - "metadata": {}, - "outputs": [], + "metadata": { + "ExecuteTime": { + "end_time": "2025-10-13T18:49:00.175346Z", + "start_time": "2025-10-13T18:48:53.645652Z" + } + }, "source": [ - "# ВАШ КОД ЗДЕСЬ" - ] + "count_days = int(input(\"Введите сколько дней осталось до отпуска\"))\n", + "# наверно нужно посчитать кол-во полных недель (+2 за каждую неделю) и остаток (если == 6 то +1)\n", + "\n", + "count_week = count_days//7\n", + "count_last_days = count_days%7\n", + "\n", + "# суббота? тогда +1\n", + "is_need_add_plus_one = count_last_days == 6\n", + "addition = 0\n", + "\n", + "if is_need_add_plus_one:\n", + " addition = 1\n", + "\n", + "result = count_week*2 + addition\n", + "print(result)\n" + ], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "4\n" + ] + } + ], + "execution_count": 13 }, { "cell_type": "markdown", @@ -81,13 +125,43 @@ }, { "cell_type": "code", - "execution_count": null, "id": "70f3324c", - "metadata": {}, - "outputs": [], + "metadata": { + "ExecuteTime": { + "end_time": "2025-10-13T19:22:17.423834Z", + "start_time": "2025-10-13T19:22:12.497119Z" + } + }, "source": [ - "# ВАШ КОД ЗДЕСЬ" - ] + "length = int(input(\"Введите длину плитки: \"))\n", + "weight = int(input(\"Введите ширину плитки: \"))\n", + "count_bite = int(input(\"Введите размер куска который отломать нужно: \"))\n", + "\n", + "# мозг сломан\n", + "# проверка что кусок не больше всей плитки\n", + "\n", + "is_not_valid_size = count_bite > length * weight\n", + "if is_not_valid_size:\n", + " print(False) # кусок слишком большой\n", + "else:\n", + " # проверяем разлом по прямой линии\n", + " if count_bite % length == 0 and count_bite // length <= weight:\n", + " print(True)\n", + " elif count_bite % weight == 0 and count_bite // weight <= length:\n", + " print(True)\n", + " else:\n", + " print(False)\n" + ], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "True\n" + ] + } + ], + "execution_count": 17 }, { "cell_type": "markdown", @@ -108,13 +182,101 @@ }, { "cell_type": "code", - "execution_count": null, "id": "8686127c", - "metadata": {}, - "outputs": [], + "metadata": { + "ExecuteTime": { + "end_time": "2025-10-13T19:50:09.673518Z", + "start_time": "2025-10-13T19:50:02.400224Z" + } + }, "source": [ - "# ВАШ КОД ЗДЕСЬ" - ] + "# эээээээээээээээээээээээээ\n", + "\n", + "# Римские числа:\n", + "# I=1, V=5, X=10, L=50, C=100, D=500, M=1000\n", + "# Повторяем символ до 3 раз: III=3, XX=20\n", + "# Если меньший слева от большего — вычитаем: IV=4, IX=9, XL=40, CM=900\n", + "# Иначе складываем слева направо: VIII=8, LX=60\n", + "\n", + "number = int(input(\"Введите число (до 3999): \"))\n", + "result = ''\n", + "\n", + "### проверка на M - 1000\n", + "count_M = number // 1000\n", + "result += 'M' * count_M\n", + "remainder = number % 1000\n", + "\n", + "### проверка на CM - 900\n", + "count_CM = remainder // 900\n", + "result += 'CM' * count_CM\n", + "remainder = remainder % 900\n", + "\n", + "### проверка на D - 500\n", + "count_D = remainder // 500\n", + "result += 'D' * count_D\n", + "remainder = remainder % 500\n", + "\n", + "### проверка на CD - 400\n", + "count_CD = remainder // 400\n", + "result += 'CD' * count_CD\n", + "remainder = remainder % 400\n", + "\n", + "# C - 100\n", + "count_C = remainder // 100\n", + "result += 'C' * count_C\n", + "remainder = remainder % 100\n", + "\n", + "# XC - 90\n", + "count_XC = remainder // 90\n", + "result += 'XC' * count_XC\n", + "remainder = remainder % 90\n", + "\n", + "# L - 50\n", + "count_L = remainder // 50\n", + "result += 'L' * count_L\n", + "remainder = remainder % 50\n", + "\n", + "# XL - 40\n", + "count_XL = remainder // 40\n", + "result += 'XL' * count_XL\n", + "remainder = remainder % 40\n", + "\n", + "# X - 10\n", + "count_X = remainder // 10\n", + "result += 'X' * count_X\n", + "remainder = remainder % 10\n", + "\n", + "# IX - 9\n", + "count_IX = remainder // 9\n", + "result += 'IX' * count_IX\n", + "remainder = remainder % 9\n", + "\n", + "# V - 5\n", + "count_V = remainder // 5\n", + "result += 'V' * count_V\n", + "remainder = remainder % 5\n", + "\n", + "# IV - 4\n", + "count_IV = remainder // 4\n", + "result += 'IV' * count_IV\n", + "remainder = remainder % 4\n", + "\n", + "# I - 1\n", + "count_I = remainder\n", + "result += 'I' * count_I\n", + "\n", + "print(result)\n" + ], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "CCXXXIV\n" + ] + } + ], + "execution_count": 18 }, { "cell_type": "markdown", @@ -136,13 +298,49 @@ }, { "cell_type": "code", - "execution_count": null, "id": "74e39179", - "metadata": {}, - "outputs": [], + "metadata": { + "ExecuteTime": { + "end_time": "2025-10-13T20:03:23.333955Z", + "start_time": "2025-10-13T20:03:20.999505Z" + } + }, "source": [ - "# ВАШ КОД ЗДЕСЬ" - ] + "######### yo soy francesco virgolini\n", + "### uiiiiiiiiiiiiiiiiii\n", + "\n", + "input_data = input(\"Введите данные:\")\n", + "\n", + "dot_count = input_data.count('.')\n", + "\n", + "if dot_count > 1:\n", + " print(False)\n", + "else:\n", + " # убираем точку\n", + " temp = input_data.replace('.', '')\n", + "\n", + " # проверка на пустую строку\n", + " if len(temp) == 0:\n", + " print(False)\n", + " # проверка на недопустимые символы\n", + " elif temp.replace('0','').replace('1','').replace('2','').replace('3','')\\\n", + " .replace('4','').replace('5','').replace('6','').replace('7','')\\\n", + " .replace('8','').replace('9','') != '':\n", + " print(False)\n", + " else:\n", + " print(True)\n", + "\n" + ], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "False\n" + ] + } + ], + "execution_count": 20 } ], "metadata": {