project_python/3.1_lesson.8.20.py

18 lines
609 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

***Задание 2 Параграф 3.1***
***Напишите программу, которая для каждой строки описания местности:
выводит позицию первого появления слова зайка (нумерация начинается с 1);
если в строке нет зайки — выведите: Заек нет =(.***
if name == "main":
# метод find
count = int(input())
for _ in range(count):
position = input().find('зайка') + 1
if position:
print(position)
else:
print("Заек нет =(")