forked from miczar1/djfz-24_25
zadD0 zrobione, poprawione inputy
This commit is contained in:
parent
d5bf1e39ad
commit
afed3aee82
TaskD00
TaskD01
TaskD02
TaskD03
TaskD04
TaskD05
File diff suppressed because one or more lines are too long
31
TaskD00/taskD0.py
Normal file
31
TaskD00/taskD0.py
Normal file
@ -0,0 +1,31 @@
|
||||
import re
|
||||
|
||||
dictionary = {
|
||||
'0': 'a',
|
||||
'1': 'b',
|
||||
'2': 'c',
|
||||
'3': 'd',
|
||||
'4': 'e',
|
||||
'5': 'f',
|
||||
'6': 'g',
|
||||
'7': 'h',
|
||||
'8': 'i',
|
||||
'9': 'j',
|
||||
}
|
||||
|
||||
with open('simple.in', encoding='utf8') as file:
|
||||
lines = file.readlines()
|
||||
pattern = r'\d{4}'
|
||||
|
||||
for line in lines:
|
||||
line = line.strip()
|
||||
x = re.findall(pattern, line)
|
||||
|
||||
if x:
|
||||
for words in x:
|
||||
decoded_word = ''
|
||||
for char in words:
|
||||
decoded_word += dictionary[char]
|
||||
line = line.replace(words, decoded_word, 1)
|
||||
|
||||
print(line)
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user