dict = {}
def colors(col):
if col == "red":
return "\033[31m"
elif col == "green":
return "\033[32m"
elif col == "yellow":
return "\033[33m"
elif col == "blue":
return "\033[34m"
elif col == "magenta":
return "\033[35m"
def seperator(x):
colors1 = ["red","green","yellow","blue","magenta"]
for char in x:
y = random.choice(colors1)
print(f"{colors(y)}{char}",end="")
time.sleep(0.2)
seperator("MokeBeast")
I am trying to make python print the letters of this string with a 0.2 delay between each one on one single line.
I was expecting it to print out my string like this:
M (wait 0.2sec) o (wait 0.2sec) k (wait 0.2sec) e (wait 0.2sec) B (wait 0.2sec) e (wait 0.2sec) etc...
What keeps happening is that it does not print the letter one by one, instead it waits all those delays and then prints the string all in one like this: MokeBeast
How can I fix this?