Created
February 15, 2024 12:08
-
-
Save bwindsor/a5313d0591a136cc141f8fe6abd394d2 to your computer and use it in GitHub Desktop.
Function to time you typing the alphabet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def time_alphabet(): | |
print("Time starts when you press a. Time will be printed when you finish by pressing z. If you go wrong, it won't tell you and your time won't stop. Press 0 to quit in this case.") | |
a1 = msvcrt.getch() | |
if a1 == b'a': | |
t0 = time.monotonic() | |
u = b'' | |
while u != b'bcdefghijklmnopqrstuvwxyz': | |
c = msvcrt.getch() | |
u += c | |
if c == b'0': | |
return | |
t1 = time.monotonic() | |
print(t1-t0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment