From 4b7b70c4f454b565d25ea28b35df69bc14ec7618 Mon Sep 17 00:00:00 2001 From: PaLoLegych Date: Mon, 14 Feb 2022 10:11:42 +0300 Subject: [PATCH 01/11] Hello world (python) --- Hello.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 Hello.py diff --git a/Hello.py b/Hello.py new file mode 100644 index 0000000..8eb74cf --- /dev/null +++ b/Hello.py @@ -0,0 +1 @@ +print('Hello world') \ No newline at end of file From f33b103f755163e3c9241e610a97740f14d15e00 Mon Sep 17 00:00:00 2001 From: Pavel Date: Fri, 18 Feb 2022 14:29:02 +0300 Subject: [PATCH 02/11] connection test --- Lesson_1/.idea/.gitignore | 3 +++ Lesson_1/.idea/Lesson_1.iml | 10 ++++++++++ .../inspectionProfiles/profiles_settings.xml | 6 ++++++ Lesson_1/.idea/misc.xml | 4 ++++ Lesson_1/.idea/modules.xml | 8 ++++++++ Lesson_1/.idea/vcs.xml | 6 ++++++ Lesson_1/info.py | 16 ++++++++++++++++ Lesson_1/task_1.py | 1 + Lesson_1/task_2.py | 0 9 files changed, 54 insertions(+) create mode 100644 Lesson_1/.idea/.gitignore create mode 100644 Lesson_1/.idea/Lesson_1.iml create mode 100644 Lesson_1/.idea/inspectionProfiles/profiles_settings.xml create mode 100644 Lesson_1/.idea/misc.xml create mode 100644 Lesson_1/.idea/modules.xml create mode 100644 Lesson_1/.idea/vcs.xml create mode 100644 Lesson_1/info.py create mode 100644 Lesson_1/task_1.py create mode 100644 Lesson_1/task_2.py diff --git a/Lesson_1/.idea/.gitignore b/Lesson_1/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/Lesson_1/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/Lesson_1/.idea/Lesson_1.iml b/Lesson_1/.idea/Lesson_1.iml new file mode 100644 index 0000000..74d515a --- /dev/null +++ b/Lesson_1/.idea/Lesson_1.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/Lesson_1/.idea/inspectionProfiles/profiles_settings.xml b/Lesson_1/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/Lesson_1/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/Lesson_1/.idea/misc.xml b/Lesson_1/.idea/misc.xml new file mode 100644 index 0000000..a4652f3 --- /dev/null +++ b/Lesson_1/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Lesson_1/.idea/modules.xml b/Lesson_1/.idea/modules.xml new file mode 100644 index 0000000..a04d3c7 --- /dev/null +++ b/Lesson_1/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Lesson_1/.idea/vcs.xml b/Lesson_1/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/Lesson_1/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Lesson_1/info.py b/Lesson_1/info.py new file mode 100644 index 0000000..94e3a87 --- /dev/null +++ b/Lesson_1/info.py @@ -0,0 +1,16 @@ +# This is a sample Python script. + +# Press ⌃R to execute it or replace it with your code. +# Press Double ⇧ to search everywhere for classes, files, tool windows, actions, and settings. + + +def print_hi(name): + # Use a breakpoint in the code line below to debug your script. + print(f'Hi, {name}') # Press ⌘F8 to toggle the breakpoint. + + +# Press the green button in the gutter to run the script. +if __name__ == '__main__': + print_hi('PyCharm') + +# See PyCharm help at https://www.jetbrains.com/help/pycharm/ diff --git a/Lesson_1/task_1.py b/Lesson_1/task_1.py new file mode 100644 index 0000000..314b8ac --- /dev/null +++ b/Lesson_1/task_1.py @@ -0,0 +1 @@ +print(5*5) \ No newline at end of file diff --git a/Lesson_1/task_2.py b/Lesson_1/task_2.py new file mode 100644 index 0000000..e69de29 From f4fd7e8521abd3e4ebba1b3dec02e2c4d23f86f5 Mon Sep 17 00:00:00 2001 From: Pavel Date: Fri, 18 Feb 2022 15:34:30 +0300 Subject: [PATCH 03/11] The solution of the first task was added --- Lesson_1/task_1.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Lesson_1/task_1.py b/Lesson_1/task_1.py index 314b8ac..17d8abb 100644 --- a/Lesson_1/task_1.py +++ b/Lesson_1/task_1.py @@ -1 +1,19 @@ -print(5*5) \ No newline at end of file +print( + 'Поработайте с переменными, создайте несколько, выведите на экран. Запросите у пользователя некоторые числа и строки и сохраните в переменные, затем выведите на экран.') +a = 10 +b = 45.23 +c = a + b +d = a - b +x = c / d +print(a) +print(b) +print(c) +print(d) +print(x) + +name = input('Please, enter your name: ') +print("Hi, %s!" % name) +i = int(input(name + ' please, enter a random number: ')) +a = i + i * i +print('Thank you very much. The answer is:') +print(a) From 5e96983f4875bc4b2ff618f5f63eb3612abb062a Mon Sep 17 00:00:00 2001 From: Pavel Date: Fri, 18 Feb 2022 16:47:45 +0300 Subject: [PATCH 04/11] The solution of the second task was added --- Lesson_1/task_2.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Lesson_1/task_2.py b/Lesson_1/task_2.py index e69de29..043e18f 100644 --- a/Lesson_1/task_2.py +++ b/Lesson_1/task_2.py @@ -0,0 +1,8 @@ +# Пользователь вводит время в секундах. +# Переведите время в часы, минуты, секунды и выведите в формате чч:мм:сс. +# Используйте форматирование строк. +Interval = int(input('Please, enter the time interval in seconds: ')) +H = Interval // 3600 +M = (Interval - H * 3600) // 60 +S = Interval - (H * 3600 + M * 60) +input('If your time interval is equal to %d than the current time is: ' % (Interval) + '%02d:%02d:%02d' % (H, M, S)) From 28c8e8d98035b9b3e9026b71df0e2e2f102a6cd1 Mon Sep 17 00:00:00 2001 From: Pavel Date: Fri, 18 Feb 2022 16:57:33 +0300 Subject: [PATCH 05/11] A small deign revision --- Lesson_1/task_1.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Lesson_1/task_1.py b/Lesson_1/task_1.py index 17d8abb..7f49dd0 100644 --- a/Lesson_1/task_1.py +++ b/Lesson_1/task_1.py @@ -1,5 +1,6 @@ -print( - 'Поработайте с переменными, создайте несколько, выведите на экран. Запросите у пользователя некоторые числа и строки и сохраните в переменные, затем выведите на экран.') +# Поработайте с переменными, создайте несколько, выведите на экран. +# Запросите у пользователя некоторые числа и строки и сохраните в переменные, +# затем выведите на экран. a = 10 b = 45.23 c = a + b From 63a37580b4ffcb3df869a25c4699b67860914259 Mon Sep 17 00:00:00 2001 From: Pavel Date: Sat, 19 Feb 2022 18:14:45 +0300 Subject: [PATCH 06/11] The result of the task 3 --- Lesson_1/task_3.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 Lesson_1/task_3.py diff --git a/Lesson_1/task_3.py b/Lesson_1/task_3.py new file mode 100644 index 0000000..e7a3517 --- /dev/null +++ b/Lesson_1/task_3.py @@ -0,0 +1,11 @@ +# Узнайте у пользователя число n. +# Найдите сумму чисел n + nn + nnn. +# Например, пользователь ввёл число 3. +# Считаем 3 + 33 + 333 = 369. + +n = int(input('Please, enter a random value = ')) +x = str(n) +nn = x + x +nnn = x + x + x +cal = n + int(nn) + int(nnn) +print('Based on your value: %d ' % n + 'the result of the calculation is = %d' % cal) From 8230f6d578efbc53e476c01ad4f69bd57a4ab895 Mon Sep 17 00:00:00 2001 From: Pavel Date: Sat, 19 Feb 2022 18:17:57 +0300 Subject: [PATCH 07/11] Added some changes in "print()" --- Lesson_1/task_1.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Lesson_1/task_1.py b/Lesson_1/task_1.py index 7f49dd0..33c38c9 100644 --- a/Lesson_1/task_1.py +++ b/Lesson_1/task_1.py @@ -14,7 +14,6 @@ name = input('Please, enter your name: ') print("Hi, %s!" % name) -i = int(input(name + ' please, enter a random number: ')) +i = int(input('Please, enter a random number: ')) a = i + i * i -print('Thank you very much. The answer is:') -print(a) +print('Thank you very much. The answer is: %d' %a) From dddf7ed4bab30482423c7dd427667337f21a6067 Mon Sep 17 00:00:00 2001 From: Pavel Date: Sat, 19 Feb 2022 20:05:04 +0300 Subject: [PATCH 08/11] =?UTF-8?q?=D0=A0=D0=B0=D0=B1=D0=BE=D1=82=D0=B0?= =?UTF-8?q?=D0=B5=D1=82,=20=D0=BD=D0=BE=20=D0=BE=D1=87=D0=B5=D0=BD=D1=8C?= =?UTF-8?q?=20=D0=BA=D0=BE=D1=80=D1=8F=D0=B2=D0=BE.=20=D0=9D=D1=83=D0=B6?= =?UTF-8?q?=D0=BD=D0=BE=20=D1=80=D0=B0=D0=B7=D0=B1=D0=B8=D1=80=D0=B0=D1=82?= =?UTF-8?q?=D1=8C=D1=81=D1=8F.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Lesson_1/task_4.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 Lesson_1/task_4.py diff --git a/Lesson_1/task_4.py b/Lesson_1/task_4.py new file mode 100644 index 0000000..7015660 --- /dev/null +++ b/Lesson_1/task_4.py @@ -0,0 +1,11 @@ +# Пользователь вводит целое положительное число. +# Найдите самую большую цифру в числе. +# Для решения используйте цикл while и арифметические операции. +val = int(input('Please, enter positive value: ')) +max_val = val % 10 +while val > 0: + val = val // 10 + if val > max_val: + max_val = val % 10 + print('The largest digit in %d ' % val + 'is = %d' % max_val) + break From 87b1ad0c1e4f0f77836d790ce5f276fe05336a55 Mon Sep 17 00:00:00 2001 From: Pavel Date: Sat, 19 Feb 2022 20:48:17 +0300 Subject: [PATCH 09/11] The result of the task 5 --- Lesson_1/task_5.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Lesson_1/task_5.py diff --git a/Lesson_1/task_5.py b/Lesson_1/task_5.py new file mode 100644 index 0000000..3ebe687 --- /dev/null +++ b/Lesson_1/task_5.py @@ -0,0 +1,18 @@ +# Запросите у пользователя значения выручки и издержек фирмы. +# Определите, с каким финансовым результатом работает фирма. +# Например, прибыль — выручка больше издержек, +# или убыток — издержки больше выручки. Выведите соответствующее сообщение. +# Если фирма отработала с прибылью, вычислите рентабельность выручки. Э +# то отношение прибыли к выручке. Далее запросите численность сотрудников +# фирмы и определите прибыль фирмы в расчёте на одного сотрудника. + +rev = float(input('Please enter revenue of the company: ')) +cos = float(input('Please enter costs of the company: ')) +inc = rev - cos +if inc > 0: + print('The company is profitable.') + print(f'Return on revenue is: {inc / rev: .2f}') + staff = int(input('Please enter the number of employees:')) + print(f'Profit per employee is: {rev / staff: .2f}') +else: + print('The company is unprofitable.') From 955736211a5894d6ded5425502f49926015d409f Mon Sep 17 00:00:00 2001 From: Pavel Date: Sun, 20 Feb 2022 12:23:06 +0300 Subject: [PATCH 10/11] The code was edited (mistakes correction). --- Lesson_1/task_4.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Lesson_1/task_4.py b/Lesson_1/task_4.py index 7015660..1474b41 100644 --- a/Lesson_1/task_4.py +++ b/Lesson_1/task_4.py @@ -3,9 +3,12 @@ # Для решения используйте цикл while и арифметические операции. val = int(input('Please, enter positive value: ')) max_val = val % 10 -while val > 0: - val = val // 10 - if val > max_val: - max_val = val % 10 - print('The largest digit in %d ' % val + 'is = %d' % max_val) - break +num = val +while num > 0: + dgt = num % 10 + if dgt > max_val: + max_val = dgt + if max_val == 9: + break + num = num // 10 +print(f'The largest digit in {val} is = {max_val}') From 55ada124c89c2d3022f0ab695c8d1aeddf1e2f01 Mon Sep 17 00:00:00 2001 From: Pavel Date: Sun, 20 Feb 2022 12:45:08 +0300 Subject: [PATCH 11/11] The results of the task 6 --- Lesson_1/task_6.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Lesson_1/task_6.py diff --git a/Lesson_1/task_6.py b/Lesson_1/task_6.py new file mode 100644 index 0000000..3c8bbac --- /dev/null +++ b/Lesson_1/task_6.py @@ -0,0 +1,15 @@ +# Спортсмен занимается ежедневными пробежками. +# В первый день его результат составил a километров. +# Каждый день спортсмен увеличивал результат +# на 10% относительно предыдущего. Требуется определить номер дня, +# на который результат спортсмена составит не менее b километров. +# Программа должна принимать значения параметров a и b и +# выводить одно натуральное число — номер дня. + +a = int(input('Please enter the current distance value ')) +b = int(input('Please enter the distance you would like to run ')) +ad = 1 # ad = amount of the days +while a < b: + a = 1.1 * a + ad += 1 +print(f'If you increase your distance by 10% you will be able to run2 {b} km in {ad} days') \ No newline at end of file