forked from miczar1/djfz-24_25
second task draft
This commit is contained in:
parent
b213667c17
commit
df42c3965d
15
TaskA02/task02.py
Normal file
15
TaskA02/task02.py
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
def contains_word_hamlet(line):
|
||||||
|
target = "pies"
|
||||||
|
line_lower = line.lower()
|
||||||
|
line_length = len(line_lower)
|
||||||
|
target_length = len(target)
|
||||||
|
|
||||||
|
for i in range(line_length - target_length + 1):
|
||||||
|
if line_lower[i:i + target_length] == target:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
with open('/Users/jwieczor/Desktop/djfz-24_25-jezyki-1/TaskA02/simple.in', 'r') as file:
|
||||||
|
for line in file:
|
||||||
|
if contains_word_hamlet(line):
|
||||||
|
print(line, end='')
|
Loading…
Reference in New Issue
Block a user