Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

How do you wait in python?

+2 votes
asked Sep 1, 2020 by Jacob King (140 points)
I just want to pause the program for 3 seconds. I looked it up and a bunch of websites said to use "time.sleep(secs)". (I typed in 3 in the parenthesis of course) But this does not work when I type it in.

1 Answer

0 votes
answered Sep 6, 2020 by LiOS (6,160 points)
In Python, you will need to import a library that contains a sleep (or similar name) function.

The most basic library that contains a sleep function is time but there are lots of others.

The below code sleeps for 3 seconds.

import time

print ("Start : %s" % time.ctime())
time.sleep( 3 )
print ("End : %s" % time.ctime())
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...