Problem description: I am making a game that prints dialogue in a typewriter sort of style, where each character is printed using a for loop and time.sleep(0.04) as the delay for each character. (link to code below)
Expected behavior: The code works fine, and each character should print with a 0.04 sec delay between each character.
Actual behavior: The delays abruptly slows down when the set value for time.sleep() is less than 1 sec. As a result, the rate at which characters are printed, is much slower, but still constant. The code worked perfectly fine, without this odd bug a few weeks back. I suspect a Replit update may have caused the code to stop working as intended.
**Steps to reproduce: Here is the code:
import sys, time
def slow1(message): # fast crawl
for letter in message:
sys.stdout.write(letter) # prints on screen (without delay between letters)
sys.stdout.flush()
time.sleep(0.04)
print(“\n”)
msg = “[MAD WIZARD] I am the villain of the story. Here is my evil dialogue, which will cause millions of deaths!”
slow1(msg)
**
Bug appears at this link: https://replit.com/@JadonXia1/scrap2?v=1
Browser/OS/Device: Chrome/Windows/Laptop