Created
April 7, 2016 12:07
-
-
Save Xotabu4/7eca87e4efffceb9694db06cc389a954 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # coding=utf-8 | |
| ALPHABET = u'абвгдеёжзийклмнопрстуфхцчшщъыьэюя' | |
| with open('text.txt') as f: | |
| lines = f.readlines() | |
| lines = [line.decode("utf-8") for line in lines] | |
| print '###TASK 1:' | |
| for line in lines: | |
| if len(line) > 20: | |
| print line | |
| print '###TASK 2' | |
| text_no_lines = ''.join(lines) | |
| CODES = [] | |
| for letter in ALPHABET: | |
| CODES.append(text_no_lines.rfind(letter)) | |
| for code, letter in zip(CODES, ALPHABET): | |
| print code, letter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment