jfz-2023-s474155/TaskA01/run.py

24 lines
634 B
Python

def checkFile(file):
hamlet = ['h', 'a', 'm', 'l', 'e', 't']
i = 0
line = 1
word = ''
with open(file, 'r', encoding='utf-8') as sampleCheck:
for row in sampleCheck:
for char in row:
if char.lower() == hamlet[i]:
i += 1
word += char
if i == len(hamlet):
print(line)
i = 0
word = ''
else:
i = 0
word = ''
line += 1
file = 'shakespeare.in'
checkFile(file)