22 - python & all web labs
This commit is contained in:
25
labPython/lab21/task_2.py
Normal file
25
labPython/lab21/task_2.py
Normal file
@@ -0,0 +1,25 @@
|
||||
def filter_gen5(s):
|
||||
vowels = "aeiouAEIOU"
|
||||
for ch in s:
|
||||
if ch in vowels:
|
||||
yield ch
|
||||
|
||||
|
||||
while True:
|
||||
print("фильтрация гласных")
|
||||
print("1 - Ввести строку")
|
||||
print("0 - Выход")
|
||||
choice = input("Выбор: ")
|
||||
|
||||
if choice == "0":
|
||||
break
|
||||
|
||||
if choice == "1":
|
||||
try:
|
||||
s = input("Введите строку: ")
|
||||
gen = filter_gen5(s)
|
||||
print("Результат:")
|
||||
for ch in gen:
|
||||
print(ch)
|
||||
except:
|
||||
print("Ошибка")
|
||||
Reference in New Issue
Block a user