first task draft

This commit is contained in:
jwieczor 2024-11-15 22:52:11 +01:00
parent 6e757f969a
commit b213667c17

14
TaskA01/task01.py Normal file
View File

@ -0,0 +1,14 @@
def contains_word_hamlet(line):
target = "Hamlet"
line_length = len(line)
target_length = len(target)
for i in range(line_length - target_length + 1):
if line[i:i + target_length] == target:
return True
return False
with open('/Users/jwieczor/Desktop/djfz-24_25-jezyki-1/TaskA01/simple.in', 'r') as file:
for line in file:
if contains_word_hamlet(line):
print(line, end='')