Edited TaskB00 and edded READ file

This commit is contained in:
IgnBys 2023-11-01 23:04:51 +01:00
parent 81cb332f8a
commit 5e460ef202
3 changed files with 10 additions and 6 deletions

View File

@ -0,0 +1,2 @@
If you use windows please write this command in terminal:
python .\run.py .\fsa_description.arg .\test1.in .\test1.out

View File

@ -1,17 +1,18 @@
import sys import sys
def write_answer(answer): def write_answer(answer):
with open('test1.out', 'a') as file: with open(output_file, 'a') as file:
file.write(answer+'\n') file.write(answer+'\n')
def find_next_position(position, character): def find_next_position(position, character):
with open('fsa_description.arg', 'r') as readed_used_table: with open(used_table, 'r') as readed_used_table:
for row_used_table in readed_used_table: for row_used_table in readed_used_table:
line = row_used_table.strip().split('\t') line = row_used_table.strip().split('\t')
if position == line[0] and character == line[2]: if position == line[0] and character == line[2]:
return True,line[1] return True,line[1]
# used_table = sys.argv[1] used_table = sys.argv[1]
# input_file = sys.argv[2] input_file = sys.argv[2]
with open('test1.out', 'w') as readed_output_file: output_file = sys.argv[3]
with open('test1.in', 'r') as readed_input_file: with open(output_file, 'w') as readed_output_file:
with open(input_file, 'r') as readed_input_file:
for row_input_file in readed_input_file: for row_input_file in readed_input_file:
result = False result = False
next_position = None next_position = None

View File

@ -6,3 +6,4 @@ NO
NO NO
NO NO
NO NO
NO