Answer the question
In order to leave comments, you need to log in
How to make Python output Russian text?
What needs to be done so that the Cyrillic alphabet is displayed in the console?
For English. alphabet - works, but for Russian - no.
__author__ = 'getlucky'
# -*- coding: utf-8 -*-
def cesarMethod(message):
output = []
alphabet = 'abcdefghijklmnopqrstuvwxyz'#'абвгдеёжзийклмнопрстуфхцчшщъыьэюя'
steps = int(raw_input('Введите Ваш ключ: '))
for i in message:
if i == ' ':
output.append(' ')
else:
pos = alphabet.index(i) + steps
if pos >= 25:
pos -= 26
output.append(alphabet[pos].decode('utf8'))
print 'Зашифрованное сообщение: ', ''.join(output)
message = raw_input('Введите Ваше сообщение: ').lower()
cesarMethod(message)
Answer the question
In order to leave comments, you need to log in
# -*- coding: utf-8 -*-
message = 'ывпавыапавыпвпав'
for i in message:
print(i)
message = u'ывпавыапавыпвпав'
for i in message:
print(i)
# -*- coding: utf-8 -*-
def cesarMethod(message):
output = []
# alphabet = 'abcdefghijklmnopqrstuvwxyz'#'абвгдеёжзийклмнопрстуфхцчшщъыьэюя'
alphabet = u'абвгдеёжзийклмнопрстуфхцчшщъыьэюя'
# steps = int(raw_input('Введите Ваш ключ: '))
steps = 2
for i in message.decode('utf8'):
if i == ' ':
output.append(' ')
else:
pos = alphabet.index(i) + steps
if pos >= 25:
pos -= 26
output.append(alphabet[pos])
print 'Зашифрованное сообщение: ', ''.join(output)
# message = raw_input('Введите Ваше сообщение: ').lower()
message = 'специальнодлятостера'
cesarMethod(message)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question