Can someone help with module in python | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

Can someone help with module in python

I am trying to use the time.sleep line of code for python but there is no delay so it just goes right away this is what I have import time print("hello") time.sleep(2) print("how are you")

8th Feb 2024, 12:54 AM
Amber Jones
Amber Jones - avatar
3 Réponses
0
Amber Jones , It must be a Sololearn playground thing, because it works in Pydroid 3. You know how the playgrounds takes all input before running the program? It apparently also stores all output while the program is running, then prints it after. It seems like you can tell that time.sleep(2) is being executed, because nothing happens for a while before it prints everything.
8th Feb 2024, 1:48 AM
Rain
Rain - avatar
0
If you run the program, you should see that the output console take some more time to load than the usual. Actually, in the sololearn playground, when you run a code, it mainly runs in the background and then show you the output only. Here, in your code, the playground first print "hello" in the background, then waits for 2 seconds, then print "how are you", and during this background process, you just see the loading sign in the output console. Now, when the process is finished, you see the result all together, so, you don't understand if the program was sleeping for that 2 seconds or not. Now, about Solution, I can think only of using an external IDE.
8th Feb 2024, 1:49 AM
I-M-J
I-M-J - avatar
0
I M J , Jinx. (We posted the same thing at the same time.)
8th Feb 2024, 1:51 AM
Rain
Rain - avatar