Created
July 12, 2019 14:30
-
-
Save XChrisUnknownX/92a39a9809cd70ad1a816becfb55afd8 to your computer and use it in GitHub Desktop.
Takes user’s custom string and streams it at specified WPM.
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
import time | |
import random | |
ptest = input("Characters to stream: ") | |
wordslist = ptest.split() | |
characters = len(ptest) | |
words = len(wordslist) | |
while True: | |
wordspermin = input("Enter desired words per minute: ") | |
try: | |
wordspermin = int(wordspermin) | |
except: | |
print("Bad value entered. Defaulting to 180 words per minute.") | |
wordspermin = 180 | |
break | |
minutes = words / wordspermin | |
seconds = minutes / 60 | |
# most of the math below is irrelevant and done while I'm trying to work out a proper algorithm. | |
wps = wordspermin / 60 | |
avgcharactersperword = characters / words | |
newwords = characters / avgcharactersperword | |
newwps = newwords / 60 | |
characterspersecond = characters / seconds | |
# maybe? | |
characterspermin = characters / minutes | |
characterspersecond = characterspermin / 60 | |
# duh | |
stream = 1 / characterspersecond | |
for i in ptest: | |
print(i,end="",flush=True) | |
time.sleep(stream) | |
print() | |
input("Program ended. Press enter to exit.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment