You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#Q1.Create a threading process such that it sleeps for 5 seconds and then prints out a message.
8
+
9
+
'''
10
+
def task():
11
+
print("Wait for 5 seconds")
12
+
time.sleep(5)
13
+
print("Hello")
14
+
15
+
threading.Thread(target=task).start()
16
+
17
+
'''
18
+
19
+
###############################
20
+
21
+
22
+
#Q2. Make a thread that prints numbers from 1-10, waits for 1 sec between
23
+
24
+
'''
25
+
def task():
26
+
for i in range(1,11):
27
+
print(i)
28
+
time.sleep(1)
29
+
30
+
threading.Thread(target=task).start()
31
+
32
+
'''
33
+
34
+
#################################
35
+
36
+
37
+
#Q3.Make a list that has 5 elements.Create a threading process that prints the 5 elements of the list with a delay of multiple of 2 sec between each display. Delay goes like 2sec-4sec-6sec-8sec-10sec
0 commit comments