22 - python & all web labs

This commit is contained in:
2026-05-02 20:27:02 +05:00
parent ef77f101fa
commit 19af922baf
5781 changed files with 770492 additions and 96 deletions

29
labPython/lab21/task_1.py Normal file
View File

@@ -0,0 +1,29 @@
import math
def simple_gen5(lst):
for x in lst:
if x >= 0:
yield math.sqrt(x)
else:
yield None
while True:
print("генерация квадратных корней")
print("1 - Ввести список")
print("0 - Выход")
choice = input("Выбор: ")
if choice == "0":
break
if choice == "1":
try:
data = list(map(int, input("Введите числа через пробел: ").split()))
gen = simple_gen5(data)
print("Результат:")
for val in gen:
print(val)
except:
print("Ошибка ввода")