Facebook
From Voluminous Gibbon, 3 Years ago, written in Python.
Embed
Download Paste or View Raw
Hits: 187
  1. alphabet = "AĄBCĆDEĘFGHIJKLŁMNŃOÓPRSŚTUWYZŹŻ1234567890 ".lower()
  2.  
  3.  
  4. cesar_string = input("proszę o poadnie ciągu do odkodowania: ").lower()
  5. steps = int(input("proszę o podanie przesunięcia: "))
  6.  
  7.  
  8. my_string = ''
  9.  
  10.  
  11. for cesar_char in cesar_string:
  12.     cesar_position = alphabet.find(cesar_char)
  13.     if (cesar_position - steps >= 0):
  14.         char = alphabet[cesar_position - steps]
  15.         my_string = my_string + char
  16.     else:
  17.         position = len(alphabet) - (steps - cesar_position)
  18.         char = alphabet[position]
  19.         my_string = my_string + char
  20.  
  21. print("odkodowany ciąg to: " + my_string)
  22.