Advertisement
Guest User

qwerty_switcher.py

a guest
Aug 9th, 2020
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.64 KB | None | 0 0
  1. #!/usr/bin/python3
  2. # -*- coding: utf-8 -*-
  3.  
  4. qwerty  = "qwertyuiop[]asdfghjkl;'zxcvbnm,./QWERTYUIOP{}ASDFGHJKL:\"ZXCVBNM<>?"
  5. RUWERTY = "йцукенгшщзхъфывапролджэячсмитьбю.ЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ."
  6. qwerty_list = list(qwerty)
  7. RUWERTY_LIST = list(RUWERTY)
  8.  
  9. in_str = input()
  10. out_str = ""
  11.  
  12. for char in in_str:
  13.     if char in qwerty:
  14.         index = qwerty_list.index(char)
  15.         out_str += RUWERTY_LIST[index]
  16.     elif char in RUWERTY:
  17.         index = RUWERTY_LIST.index(char)
  18.         out_str += qwerty_list[index]
  19.     else:
  20.         out_str += char
  21.  
  22. print(out_str)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement