From de6e5abbc84e01325a9c038024b694993bebcb8c Mon Sep 17 00:00:00 2001 From: fox Date: Thu, 18 Sep 2025 19:22:01 +0500 Subject: [PATCH] add --- Practica3/task1_rpo254.py | 6 ++++++ Practica3/task2_rpo254.py | 26 ++++++++++++++++++++++++++ Practica3/task3_rpo254.py | 13 +++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 Practica3/task1_rpo254.py create mode 100644 Practica3/task2_rpo254.py create mode 100644 Practica3/task3_rpo254.py diff --git a/Practica3/task1_rpo254.py b/Practica3/task1_rpo254.py new file mode 100644 index 0000000..59e7e3d --- /dev/null +++ b/Practica3/task1_rpo254.py @@ -0,0 +1,6 @@ +a = int(input()) #start +b = int(input()) #end + +for i in range(a, b + 1): + if i % 7 == 0: + print(i) diff --git a/Practica3/task2_rpo254.py b/Practica3/task2_rpo254.py new file mode 100644 index 0000000..334b505 --- /dev/null +++ b/Practica3/task2_rpo254.py @@ -0,0 +1,26 @@ +a = int(input("start ")) #нач диап +b = int(input("end ")) #кон диап + +num = int() #иниц переменной + +print("1:") +for i_one in range(a, b+1): + print(i_one, end=' ') #end=' ' делает пробел над каждым числом который выводит i_one. Сделанно для нормальной прочитанности ответа. +print("\n") #Типичная табуляция, узнал об этом в си. Делает каждый раз переход на новую строку, ну или n = new line + +print("2:") +for i_two in range(b, a -1, -1): + print(i_two, end=' ') +print("\n") + +print("3:") +for i_three in range(a, b+1): + if i_three % 7 == 0: # Если i_three делится без остатка на 7 и остаток сравним с 0 то выполнять условие дальше. Я понимаю работу этого выражения. + print(i_three, end=' ') +print("\n") + +for i_four in range(a, b+1): + if i_four % 5 == 0: + num += 1 +print("4:", num) + diff --git a/Practica3/task3_rpo254.py b/Practica3/task3_rpo254.py new file mode 100644 index 0000000..3dffb00 --- /dev/null +++ b/Practica3/task3_rpo254.py @@ -0,0 +1,13 @@ +a = int(input("start ")) +b = int(input("end ")) + +for i in range(a,b+1): + if i % 3 == 0: + print("Fizz") + if i % 5 == 0: + print("Buzz") + if i % 3 == 0 and i % 5 == 0: + print("Fizz Buzz") + if i % 3 != 0 and i % 5 != 0: + print(i) +