Question: why does in Python code time.sleep(3) not print items from list every 3 secs...? here is my simple code that i am running in http://py3.codeskulptor.org

why does in Python code time.sleep(3) not print items from list every 3 secs...? here is my simple code that i am running in http://py3.codeskulptor.org

for some reason the sleep(3) holds everything and then prints it at one time....!!!??... but according to code description, suppose to print a line every 3 secs

import time

mylist = ['aaa','bbb','ccc']

for i in mylist:

time.sleep(3)

print(i)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!