Skip to content

Commit 5c40e94

Browse files
author
uralbash
committed
Merge branch 'artmax-master'
Conflicts: practice2/EltyshevAS
2 parents 3deb3a3 + a59bc55 commit 5c40e94

File tree

2 files changed

+33
-7
lines changed

2 files changed

+33
-7
lines changed

practice2/EltyshevAS

-7
This file was deleted.

practice2/EltyshevAS/practice2.py

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# coding: utf-8
2+
3+
def main(args):
4+
if len(args) > 3:
5+
script_name, input_file_name, output_file_name = args
6+
else:
7+
input_file_name, output_file_name = "input.txt", "output.txt"
8+
input_file = open(input_file_name)
9+
output_file = open(output_file_name, 'w')
10+
11+
string = "1 2 3 4 5 6 7 8 9 10"
12+
encoded_content = ""
13+
14+
for line in input_file:
15+
for i in range(len(line)):
16+
if ord(line[i]) > 191 and ord(line[i]) < 256:
17+
offset = 0;
18+
if line[i].islower():
19+
offset = 32
20+
if ord(line[i]) + int(string.split(' ')[i%len(string.split(' '))]) > 223+offset:
21+
encoded_content += chr(191+offset+(ord(line[i]) + int(string.split(' ')[i%len(string.split(' '))]))%(223+offset))
22+
else:
23+
encoded_content += chr(ord(line[i]) + int(string.split(' ')[i%len(string.split(' '))]))
24+
else:
25+
encoded_content += line[i]
26+
output_file.write(encoded_content)
27+
input_file.close()
28+
output_file.close()
29+
30+
31+
if __name__ == '__main__':
32+
from sys import argv
33+
main(argv)

0 commit comments

Comments
 (0)