Last active
April 12, 2018 06:37
-
-
Save nithikan/dbb0f9991fa9a68a04df8bff81e66c71 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##### Exercise 2 Write a function that creates an array based on the function parameter. | |
##### Function will populate the array with consecutive numbers, then scale them. | |
##### 12/04/2018 | |
##### Nithikan Srinakrung - Bam | |
##### DFL, FTSM, UKM | |
import numpy as np | |
import time | |
def scale_number (a,b): | |
d = [] | |
s = time.time() | |
for i in range(a): | |
c = (i*b) | |
d.append(c) | |
print(time.time()-s) | |
return d | |
def scale_number2 (a,b): | |
d = np.zeros(a) | |
s = time.time() | |
for i in range(a): | |
c = (i*b) | |
d[i]= c | |
print(time.time()-s) | |
return d | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment