@@ -13,24 +13,21 @@ def calculate_square(numbers):
13
13
print ("calculate square numbers" )
14
14
for n in numbers :
15
15
time .sleep (0.00000000002 )
16
- print ('calculated square:' ,n * n )
17
-
16
+ print ('calculated square:' , n * n )
17
+
18
+
18
19
#function 2
19
20
def calculate_cube (numbers ):
20
21
print ("calculate cube numbers" )
21
22
for n in numbers :
22
23
time .sleep (0.00000000002 )
23
- print ('calculated cube:' ,n * n * n )
24
-
25
-
26
- array_numbers = [1 ,2 ,3 ,4 ,5 ,6 ,7 ]
27
-
24
+ print ('calculated cube:' , n * n * n )
28
25
26
+ array_numbers = [1 , 2 , 3 , 4 , 5 , 6 , 7 ]
29
27
30
28
#creatings threads
31
- thr1 = threading .Thread (target = calculate_square ,args = (array_numbers ,))
32
- thr2 = threading .Thread (target = calculate_cube ,args = (array_numbers ,))
33
-
29
+ thr1 = threading .Thread (target = calculate_square , args = (array_numbers ,))
30
+ thr2 = threading .Thread (target = calculate_cube , args = (array_numbers ,))
34
31
35
32
if __name__ == "__main__" :
36
33
@@ -45,4 +42,3 @@ def calculate_cube(numbers):
45
42
thr2 .join ()
46
43
47
44
print ("Executed in" , time .time ()- t )
48
-
0 commit comments