-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathvideo24.py
More file actions
59 lines (36 loc) · 711 Bytes
/
video24.py
File metadata and controls
59 lines (36 loc) · 711 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# -*- coding: utf-8 -*-
"""Video24.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1JDTKy6tFC2itf2Tz7FHsdLQEGu3NFGmA
"""
import time
import numpy as np
num = 10000000 # dah milion
num
a = list(range(num))
b = list(reversed(range(num)))
c= list()
for i in range(num):
c.append(a[i]+b[i])
c[0]
c[2]
c[12548]
c = []
c[99999999]
st = time.time()
for i in range(num):
c.append(a[i]+b[i])
et = time.time()
print(et-st)
ap = np.array(list(range(num)))
bp = np.array(list(reversed(range(num))))
ap[10]
ap[0]
ap[9999999]
bp[0]
stp = time.time()
c = np.add(ap, bp)
etp = time.time()
print(etp-stp)
print((et-st)/(etp-stp))