From 4ac1e798155c797bcad62621a9ff9ad2fb79fa30 Mon Sep 17 00:00:00 2001 From: fox Date: Mon, 22 Sep 2025 13:46:31 +0500 Subject: [PATCH] add --- Practica3/task1_rpo254.py | 17 ++++++++--- Practica3/task2_rpo254.py | 54 +++++++++++++++++---------------- Practica3/task3_rpo254.py | 22 ++++++-------- Practica3/task4_rpo254.py | 15 +++++++++ Practica3/task5_vlkad_rpo254.py | 15 +++++++++ 5 files changed, 79 insertions(+), 44 deletions(-) create mode 100644 Practica3/task4_rpo254.py create mode 100644 Practica3/task5_vlkad_rpo254.py diff --git a/Practica3/task1_rpo254.py b/Practica3/task1_rpo254.py index 59e7e3d..54a8e34 100644 --- a/Practica3/task1_rpo254.py +++ b/Practica3/task1_rpo254.py @@ -1,6 +1,13 @@ -a = int(input()) #start -b = int(input()) #end +#!/usr/bin/env python +a = int(input()) +b = 1 +while b < 10: + print(f"{a} * {b} = {a*b}") + b += 1 -for i in range(a, b + 1): - if i % 7 == 0: - print(i) +# Через for i можно реализовать полную таблицу умножения +#for i in range(1, 10 + 1): +# for b in range(1, 10 + 1): +# n = i * b +# print("{} * {} = {}".format(i, b, n)) +# print("-=-=-=-=-") diff --git a/Practica3/task2_rpo254.py b/Practica3/task2_rpo254.py index 334b505..d0e42ba 100644 --- a/Practica3/task2_rpo254.py +++ b/Practica3/task2_rpo254.py @@ -1,26 +1,28 @@ -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) - +import sys as os # удобнее так :3 +while True: + print("список для перевода в руб\n" + "- 1. В доллары\n" + "- 2. В Юани\n" + "- 3. В тенге\n" + "- 4. в Гривны\n" + "- 0. выход") + choice = int(input("Выберите :: ")) + res = int(input("Сумма(RUB) :: ")) + if choice == 0: + print("выход") + os.exit(1) + elif choice == 1: + print(f"usd: {res / 83.66}") + os.exit(1) + elif choice == 2: + print(f"cny: {res / 11.76}") + os.exit(1) + elif choice == 3: + print(f"kzt: {res / 0.15}") + os.exit(1) + elif choice == 4: + print(f"uah: {res / 2.02}") + os.exit(1) + else: + print("ОШИБКА! не введено число из списка") + os.exit(1) diff --git a/Practica3/task3_rpo254.py b/Practica3/task3_rpo254.py index 3dffb00..a1f5b84 100644 --- a/Practica3/task3_rpo254.py +++ b/Practica3/task3_rpo254.py @@ -1,13 +1,9 @@ -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) - +mini = int(input("нач :: ")) +maxi = int(input("кон :: ")) +numb = int(input("чис :: ")) +while mini < maxi: + if mini == numb: + print(f" !{mini} !", end=' ') + else: + print(mini, end=' ') + mini += 1 diff --git a/Practica3/task4_rpo254.py b/Practica3/task4_rpo254.py new file mode 100644 index 0000000..dcdb225 --- /dev/null +++ b/Practica3/task4_rpo254.py @@ -0,0 +1,15 @@ +from random import randint as r +import sys as os + +value = r(1,500) +d = -50 +while d != 0: + print("Загадано число от 1 до 500") + d = int(input("введи число: ")) + if d < value: + print("Меньше!") + elif d > value: + print("Больше!") + elif d == value: + print("Победа!") + os.exit(1) diff --git a/Practica3/task5_vlkad_rpo254.py b/Practica3/task5_vlkad_rpo254.py new file mode 100644 index 0000000..0bfafaa --- /dev/null +++ b/Practica3/task5_vlkad_rpo254.py @@ -0,0 +1,15 @@ +start_sum = int(input()) +percent = int(input()) +sum_year = int(input()) + +if start_sum > 0 or percent > 0 or years > 0: + form = 1+percent/100 + print("\nрасчет") + curr_sum = start_sum + for i in range(1,sum_year+1): + curr_sum = curr_sum * form + curr_sum = curr_sum // 1 #убрать огромный хвост после запятой + print(f"Год {i}: {curr_sum} руб.") + print(f"Итог сумма через {i} лет: {curr_sum} руб") +else: + print("Числа меньше 0!")