-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththread.py
More file actions
45 lines (31 loc) · 754 Bytes
/
thread.py
File metadata and controls
45 lines (31 loc) · 754 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import threading
import time
a = {}
data = raw_input("Please input some integers using space:\n")
data = data.split()
s = 0
for i in data:
s += float(i)
##calculate the max of sequence
def max_number():
time.sleep(1)
print 'the max of number is :', max(data)
t = threading.Thread(target=max_number)
t.daemon = True
t.run()
def he():
print 'hello'
##calculate the min of sequence
def min_number():
# time.sleep(2)
print 'the min of number is :', min(data)
t = threading.Thread(target=min_number)
t.daemon = True
t.start()
##calculate the average of nubmers
def aver_number():
# time.sleep(3)
print 'the average of number is :', s / len(data)
t = threading.Thread(target=aver_number)
t.daemon = True
t.start()