From 35b05a1707e573ab33a9edac88ca4826510ae8af Mon Sep 17 00:00:00 2001 From: Shirikova Aleksandra Date: Fri, 24 Nov 2023 00:21:01 +0300 Subject: [PATCH 1/5] 1st version --- 1_if1.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/1_if1.py b/1_if1.py index be736084..0ec81b2c 100644 --- a/1_if1.py +++ b/1_if1.py @@ -14,12 +14,22 @@ """ + def main(): - """ - Эта функция вызывается автоматически при запуске скрипта в консоли - В ней надо заменить pass на ваш код - """ - pass + """Главная функция""" + + +age = int(input("Введите свой возраст: ")) +if age < 6: + print("Вас ждет детский садик") +elif age >= 6 or age <= 18: + print("Вас ждет школа") +elif age > 18 or age < 23: + print("Вас ждет университет") +else: + print("Идите работать") + + if __name__ == "__main__": main() From 74afec08dbc5e5ae702c5b12d465ef5b6ca985a7 Mon Sep 17 00:00:00 2001 From: Shirikova Aleksandra Date: Fri, 24 Nov 2023 12:46:11 +0300 Subject: [PATCH 2/5] 2nd version --- 1_if1.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/1_if1.py b/1_if1.py index 0ec81b2c..c47f1046 100644 --- a/1_if1.py +++ b/1_if1.py @@ -22,14 +22,15 @@ def main(): age = int(input("Введите свой возраст: ")) if age < 6: print("Вас ждет детский садик") -elif age >= 6 or age <= 18: +elif age <= 18 and age >= 6: print("Вас ждет школа") -elif age > 18 or age < 23: +elif age > 18 and age < 23: print("Вас ждет университет") else: print("Идите работать") + if __name__ == "__main__": main() From d99f01ec0e9279869621acb1750139288cd428ed Mon Sep 17 00:00:00 2001 From: Shirikova Aleksandra Date: Fri, 24 Nov 2023 13:27:30 +0300 Subject: [PATCH 3/5] 3rs ver --- 1_if1.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/1_if1.py b/1_if1.py index c47f1046..0f94b9af 100644 --- a/1_if1.py +++ b/1_if1.py @@ -17,17 +17,15 @@ def main(): """Главная функция""" - - -age = int(input("Введите свой возраст: ")) -if age < 6: - print("Вас ждет детский садик") -elif age <= 18 and age >= 6: - print("Вас ждет школа") -elif age > 18 and age < 23: - print("Вас ждет университет") -else: - print("Идите работать") + age = int(input("Введите свой возраст: ")) + if age < 6: + print("Вас ждет детский садик") + elif age <= 18 and age >= 6: + print("Вас ждет школа") + elif age > 18 and age < 23: + print("Вас ждет университет") + else: + print("Идите работать") From 4118228273732f4afa1375d273f0f435e3f4633c Mon Sep 17 00:00:00 2001 From: Shirikova Aleksandra Date: Fri, 24 Nov 2023 23:00:44 +0300 Subject: [PATCH 4/5] 1st ver --- 2_if2.py | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/2_if2.py b/2_if2.py index 0f1644f3..422b41b0 100644 --- a/2_if2.py +++ b/2_if2.py @@ -15,12 +15,28 @@ """ -def main(): - """ - Эта функция вызывается автоматически при запуске скрипта в консоли - В ней надо заменить pass на ваш код - """ - pass + +def main(first_line, second_line): + if not isinstance(first_line, str) and isinstance(second_line, str): + return 0 + elif len(first_line) == len(second_line): + return 1 + elif len(first_line) > len(second_line): + if "learn" in second_line: + return 3 + else: + return 2 + elif len(first_line) < len(second_line): + if "learn" in second_line: + return 3 + else: + return ("такой комбинации не описано") + + if __name__ == "__main__": - main() + print(main("привет", "мир")) + print(main("привет", "прощай")) + print(main("привет", "солнышкоооо")) + print(main(1, "ghbdtn")) + print(main("hfhfhрррр", "learn")) From c89bb6e1f4ce612ad560a9b6ee2205b54aff3fd7 Mon Sep 17 00:00:00 2001 From: Shirikova Aleksandra Date: Sat, 25 Nov 2023 14:45:18 +0300 Subject: [PATCH 5/5] 2nd ver --- 2_if2.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/2_if2.py b/2_if2.py index 422b41b0..eb43b3a2 100644 --- a/2_if2.py +++ b/2_if2.py @@ -17,26 +17,24 @@ def main(first_line, second_line): - if not isinstance(first_line, str) and isinstance(second_line, str): + if not isinstance(first_line, str) or not isinstance(second_line, str): return 0 - elif len(first_line) == len(second_line): + elif first_line == second_line: return 1 elif len(first_line) > len(second_line): - if "learn" in second_line: + if "learn" == second_line: return 3 else: return 2 - elif len(first_line) < len(second_line): - if "learn" in second_line: - return 3 - else: - return ("такой комбинации не описано") - + elif "learn" == second_line: + return 3 + return "такой комбинации не существует" - + if __name__ == "__main__": print(main("привет", "мир")) - print(main("привет", "прощай")) + print(main("привет", "привет")) print(main("привет", "солнышкоооо")) print(main(1, "ghbdtn")) print(main("hfhfhрррр", "learn")) + print(main("hfbh", 5.32))