Printing with delay | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Printing with delay

Is it possible to print somthing with delay in python or ruby.Like someone starts the script and after 10 seconds the massage will be displayed.is this possible and how can i do it?

25th Apr 2017, 3:57 PM
Yoshyy
Yoshyy - avatar
3 Answers
+ 14
python: from time import sleep print('This is printed imediatelly.') sleep(10) # wait for 10 seconds print("This is printed 10 seconds later.")
25th Apr 2017, 4:19 PM
Ulisses Cruz
Ulisses Cruz - avatar
+ 13
Note that this will not work in the code Playground. You will get: Time Limit Exceeded
25th Apr 2017, 4:24 PM
Ulisses Cruz
Ulisses Cruz - avatar
+ 5
The first what I can explain to do a very long loop. From 0 to 10000000 for example. But I think there it is a easiest wey, special functions to set timeout.
25th Apr 2017, 4:05 PM
shaldem
shaldem - avatar