I want to write a program that prints all the elements in a list over and over again with 5 seconds of interval between each element. So if the list is [1,2,3] it would print first the 1, then wait 5 seconds, print the 2 wait 5 seconds, print the 3 wait 5 seconds,then go back to printing the 1 and waiting 5 seconds, etc...
This is the code I have to illustrate how I'm thinking but this doesn't work at all. I think I have to use the threading library because the program will be doing some repetitive tasks parallel to printing the elements in this list. '''
import threading
def func(list, i):
print(list[i])
if i < 4:
i+=1
else:
i = 0
threading.Timer(1,funcao, list, i).start()
list = ['1', '2', '3', '4']
func(list,0)
'''
How can I build such a program? (btw I'm new to programing so I'm sorry if this questions is basic but I coulnd't find any answers for this)