how do I separate two strings in python that have been printed using functions? -
i have created function print out string timed delay between each character when comes printing multiple strings, printed on same line. how separate lines? ('\n'
not work)
from time import sleep import sys def slowly(text): letters in text: print (letters, end=''), sys.stdout.flush() sleep(0.1) if letters == ',': sleep(1) slowly("hello world") slowly("hello world")
result
"hello worldhello world"...
add newline function after loop, like
from time import sleep def slowly(text): letter in text: print(letter, end = '') sleep(0.1) if letter == ',': sleep(1) print() # print newline slowly('hello world') slowly('hello world')
this works me.
output
hello world hello world
Comments
Post a Comment