From 0734409b4d71d6521bd705338817d837e19ed7a0 Mon Sep 17 00:00:00 2001 From: Vladimir Zadorozhnyy Date: Wed, 22 May 2024 15:16:12 +0300 Subject: [PATCH 1/6] a ready task 1 file --- 1_if1.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/1_if1.py b/1_if1.py index be736084..070e9915 100644 --- a/1_if1.py +++ b/1_if1.py @@ -13,13 +13,28 @@ * Вывести содержимое переменной на экран """ +def age_detector(age_input): + #activity_to_do = + if age_input < 7: + activity_to_do = 'Пользователь должен ходить в садик!' + elif age_input >= 7 and age_input < 16: + activity_to_do = 'Пользователь должен учиться в школе!' + elif age_input >= 16 and age_input < 21: + activity_to_do = 'Пользователь должен учиться в ВУЗе!' + else: #age_input >= 21: + activity_to_do = 'Пользователь должен работать!' + return activity_to_do def main(): """ Эта функция вызывается автоматически при запуске скрипта в консоли В ней надо заменить pass на ваш код """ - pass + age = int(input('Сколько Вам лет? ')) + print('Ваш возраст:', age, 'лет!') + activity = age_detector(age) + #return age + print(activity) if __name__ == "__main__": main() From a5d49312e18b01d202912177e8a8b4c2f03a2bd7 Mon Sep 17 00:00:00 2001 From: Vladimir Zadorozhnyy Date: Thu, 23 May 2024 00:31:15 +0300 Subject: [PATCH 2/6] THis is the first commi to the newest branch! --- learn-homework-1 | 1 + 1 file changed, 1 insertion(+) create mode 160000 learn-homework-1 diff --git a/learn-homework-1 b/learn-homework-1 new file mode 160000 index 00000000..0734409b --- /dev/null +++ b/learn-homework-1 @@ -0,0 +1 @@ +Subproject commit 0734409b4d71d6521bd705338817d837e19ed7a0 From 16fdf545e46fc1c5ab922c6591f74fb391d2227d Mon Sep 17 00:00:00 2001 From: Vladimir Zadorozhnyy Date: Fri, 24 May 2024 13:51:53 +0300 Subject: [PATCH 3/6] Started to work on task 2. --- 2_if2.py | 1 + 1 file changed, 1 insertion(+) diff --git a/2_if2.py b/2_if2.py index 0f1644f3..d396bc73 100644 --- a/2_if2.py +++ b/2_if2.py @@ -14,6 +14,7 @@ и выводя на экран результаты """ +#Здесь я буду писать свою функцию! def main(): """ From 4c4e13d721cdd2b351103eebba703586156f0fc2 Mon Sep 17 00:00:00 2001 From: Vladimir Zadorozhnyy Date: Fri, 24 May 2024 17:28:32 +0300 Subject: [PATCH 4/6] The task 2 is done. --- 2_if2.py | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/2_if2.py b/2_if2.py index d396bc73..0eefdc17 100644 --- a/2_if2.py +++ b/2_if2.py @@ -15,13 +15,34 @@ """ #Здесь я буду писать свою функцию! +def comparison_function(string_1, string_2): + if not (isinstance(string_1, str) and isinstance(string_2, str)): + return 0 + elif (string_1 == string_2): + return 1 + elif (not (string_1 == string_2) and len(string_1) > len(string_2)): + return 2 + elif (not (string_1 == string_2) and string_2 == 'learn'): + return 2 +# else: +# return 10 + def main(): """ Эта функция вызывается автоматически при запуске скрипта в консоли В ней надо заменить pass на ваш код """ - pass - +# a = comparison_function('stiiing1', 'stringgggg2') +# print(a) + a = comparison_function(1, 'stringgg2') + print(a) + a = comparison_function('stringgg2', 'stringgg2') + print(a) + a = comparison_function('stringgg2', 'learn') + print(a) + a = comparison_function(10, 5) + print(a) + if __name__ == "__main__": main() From 287a38968840d3596ced77e6768b675719b58614 Mon Sep 17 00:00:00 2001 From: Vladimir Zadorozhnyy Date: Sat, 25 May 2024 10:21:07 +0300 Subject: [PATCH 5/6] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=B7=D0=B0=D0=BC=D0=B5=D1=8F=D1=87=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F=20=D0=BF=D0=BE=20=D0=BA=D0=BE=D0=B4=D1=83=20=D0=B2=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=BE=D0=B3=D0=BE=20=D0=B7=D0=B0=D0=B4=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 2_if2.py | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/2_if2.py b/2_if2.py index 0eefdc17..882b2824 100644 --- a/2_if2.py +++ b/2_if2.py @@ -16,16 +16,17 @@ """ #Здесь я буду писать свою функцию! def comparison_function(string_1, string_2): - if not (isinstance(string_1, str) and isinstance(string_2, str)): + if isinstance(string_1, str) and isinstance(string_2, str): + # return 0 + #else: + if string_1 == string_2: + return 1 + elif (not (string_1 == string_2) and len(string_1) > len(string_2)): + return 2 + elif string_2 == 'learn': + return 3 + else: return 0 - elif (string_1 == string_2): - return 1 - elif (not (string_1 == string_2) and len(string_1) > len(string_2)): - return 2 - elif (not (string_1 == string_2) and string_2 == 'learn'): - return 2 -# else: -# return 10 def main(): @@ -35,14 +36,14 @@ def main(): """ # a = comparison_function('stiiing1', 'stringgggg2') # print(a) - a = comparison_function(1, 'stringgg2') - print(a) - a = comparison_function('stringgg2', 'stringgg2') - print(a) - a = comparison_function('stringgg2', 'learn') - print(a) - a = comparison_function(10, 5) - print(a) + print(comparison_function(1, 'stringgg2')) + #print(a) + print(comparison_function('stringgg2', 'stringgg2')) + #print(a) + print(comparison_function('stringgg2', 'learn')) + #print(a) + print(comparison_function(10, 5)) + #print(a) if __name__ == "__main__": main() From eeed0367d91937ff8e002ef5bc7a68fe5a970d3c Mon Sep 17 00:00:00 2001 From: Vladimir Zadorozhnyy Date: Thu, 30 May 2024 17:19:13 +0300 Subject: [PATCH 6/6] Fixed the task 2 as per the comments. --- 2_if2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2_if2.py b/2_if2.py index 882b2824..adcdc094 100644 --- a/2_if2.py +++ b/2_if2.py @@ -21,7 +21,7 @@ def comparison_function(string_1, string_2): #else: if string_1 == string_2: return 1 - elif (not (string_1 == string_2) and len(string_1) > len(string_2)): + elif len(string_1) > len(string_2): return 2 elif string_2 == 'learn': return 3