jfz-2023-s473555/TaskA02/run.py
2023-10-16 13:23:32 +02:00

42 lines
951 B
Python

import os
NUMBER_OF_INVOICES = 10
DIR = os.path.dirname(__file__)
PHRASE = "pies"
def join_path(filename: str) -> str:
return os.path.join(DIR, filename)
with open(join_path("simple.in"), "r", newline="", encoding="utf8") as file:
text = file.readlines()
def find_me():
for j in range(len(PHRASE)):
if line[i + j] != PHRASE[j] and line[i + j] != PHRASE[j].capitalize():
return False
if line[i - 1] not in [" ", "\t", "\n"]:
return False
if line[i + len(PHRASE)] not in [" ", "\t", "\n", "\r"]:
return False
return True
found = True
phrase_array_slow = []
for ind, line in enumerate(text):
for i in range(len(line)):
found = True
found = find_me()
if found:
print(ind + 1, ":", line[i:], end="")
phrase_array_slow.append(ind + 1)
break
# print(*phrase_array_slow, sep="\n")