Skip to content

Instantly share code, notes, and snippets.

@lqez
Last active March 10, 2019 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lqez/48eed8795d0f85b528962b310d895ed0 to your computer and use it in GitHub Desktop.
Save lqez/48eed8795d0f85b528962b310d895ed0 to your computer and use it in GitHub Desktop.
From a to z
import getch
import time
print("Type from a to z.")
print("Timer will begin after typing the first letter 'a'.")
print("Quit: Ctrl + C")
while True:
c = ord('a')
begin = None
while True:
char = getch.getch()
if ord(char) != c:
continue
if not begin:
begin = time.time()
print(char, end='', flush=True)
c += 1
if c > ord('z'):
break
end = time.time()
print('\t', end - begin)
@lqez
Copy link
Author

lqez commented Mar 10, 2019

Need getch to run.

pip install getch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment