Upload files to "TaskA03"
This commit is contained in:
parent
053e4d3c36
commit
0c6baf6172
31
TaskA03/run.py
Normal file
31
TaskA03/run.py
Normal file
@ -0,0 +1,31 @@
|
||||
import os
|
||||
|
||||
def tokenize_line(line):
|
||||
words = []
|
||||
current_word = ''
|
||||
for char in line:
|
||||
if char.isalnum() or char == '.':
|
||||
current_word += char
|
||||
if char == '.':
|
||||
words.append(current_word)
|
||||
current_word = ''
|
||||
elif current_word:
|
||||
words.append(current_word)
|
||||
current_word = ''
|
||||
if current_word:
|
||||
words.append(current_word)
|
||||
return words
|
||||
|
||||
def TaskA03(file_path):
|
||||
print("_______")
|
||||
with open(file_path, 'r', encoding='utf-8') as file:
|
||||
line_number = 0
|
||||
for line in file:
|
||||
line_number += 1
|
||||
words = tokenize_line(line)
|
||||
if 'r.' in words and any('19' in word for word in words):
|
||||
print(f"Line {line_number}: {line}")
|
||||
|
||||
script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
file_path = os.path.join(script_dir, 'simple.in')
|
||||
TaskA03(file_path)
|
Loading…
Reference in New Issue
Block a user