Created
July 25, 2022 16:07
-
-
Save gmakc-094423/e06a907a0182589b0a56d352c6ca7153 to your computer and use it in GitHub Desktop.
Домашнее задание к семинару № 4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def InputNumbers(inputText): | |
is_OK = False | |
while not is_OK: | |
try: | |
number = float(input(f"{inputText}")) | |
is_OK = True | |
except ValueError: | |
print("Какое-то неправильное число!") | |
return number | |
def division(num1, num2): | |
return num1 / num2 | |
num1 = InputNumbers("Введите 1 число: ") | |
num2 = InputNumbers("Введите 2 число: ") | |
n = int(InputNumbers("Введите точность (количество знаков после запятой): ")) | |
rezult = round(division(num1, num2), n) | |
print(f"Результат деления: {rezult}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def InputNumbers(inputText): | |
is_OK = False | |
while not is_OK: | |
try: | |
number = int(input(f"{inputText}")) | |
is_OK = True | |
except ValueError: | |
print("Какое-то неправильное число!") | |
return number | |
def func_search(num): | |
rezult = [] | |
for i in range(2, num): | |
while num % i == 0: | |
num /= i | |
rezult.append(i) | |
return rezult | |
num = InputNumbers("Введите натуральное число N: ") | |
print(f"Результат деления: {func_search(num)}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment