Guest User

Untitled

a guest
Mar 19th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. from msvcrt import getch
  2.  
  3. pi500 = "1415 92 6535 8979 3238 46264 3383 2795 0288 4 1971 693 993 75105 8209 74944 59230 78 1640 6286 20 8998 6280 348 2534 2117 0679 8214 8086 513 2823 0664 7093 844 60 95505 822 317 2535 9408 12848 1117 45028 41 0270 1938 52110 5559 6446 2294 89549 3038 1964 4288 1097 5665 93344 61284 7564 8233 7867 8316 527 1201 9091 4564 8566 9234 60 3486 10454 3266 4821 3393 6072 60 249 141 27372 4587 006606 31 5588 17488 15 209209 62829 254 09171 53643 6789 2590 3600 1133 05305 488 204 665 2138 4146 9519 41511 6094 3305 7270 3657 595919 5309 218 6117 3819 32611 7931 0511 8548 0744 6237 996 2749 5673 51885 75272 489 1227 9 38183 0119 49 129" # 29 rounds to 30
  4. digitct = 0
  5.  
  6. while True:
  7. print("3.", end="", flush=True)
  8. bk = False
  9. for digit in pi500:
  10. if digit == " ":
  11. print(digit, end="", flush=True)
  12. continue
  13. else:
  14. key = ord(getch())
  15. code = int(digit) + 48 # Numeral key IDs start at 48 == "0"
  16. if key == code:
  17. print(digit, end="", flush=True)
  18. digitct += 1
  19. elif key == 27:
  20. bk = True
  21. break
  22. else:
  23. print("\nIncorrect! Correct digit: {} (you typed {}). Total correct digits: {}".format(digit, key - 48, digitct))
  24. break
  25.  
  26. if bk:
  27. break
Add Comment
Please, Sign In to add comment