Skip to content

Instantly share code, notes, and snippets.

@SamyBencherif
Created May 23, 2020 00:29
Show Gist options
  • Save SamyBencherif/c030ec9c3b089aecfa863518549720f1 to your computer and use it in GitHub Desktop.
Save SamyBencherif/c030ec9c3b089aecfa863518549720f1 to your computer and use it in GitHub Desktop.
Swipe around with your finger on the keyboard and use this program to display the result. (CLI stdio)
import readline
LAYOUT = """
` 1 2 3 4 5 6 7 8 9 0 - =
q w e r t y u i o p [ ] \\
a s d f g h j k l ; '
z x c v b n m , . /
"""[1:-1]
def h(c):
return ''.join([[' ', x][x==c or x=='\n'] for x in LAYOUT])
def U(s1, s2):
o = ""
for i in range(len(s1)):
n = s1[i].strip() + s2[i].strip()
o += [[n, ' '][len(n)==0][0], '\n'][s1[i]=="\n"]
return o
def C(s):
k = h(' ')
for c in s:
k = U(k, h(c))
return k
def F(s):
for L in s.split():
print(C(L)+"\n")
def Z(s):
for i in range(4):
r = ""
for L in s.split():
r += C(L).split("\n")[i].ljust(30)
print(r)
Z(input())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment