Created
April 16, 2018 04:38
-
-
Save nithikan/5a1afb47197a6d3832be86db20f4e9fc 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 3 Take a one dimensional array of any site (length) and | |
##### create a two dimentional array out of it with the same elements. | |
##### 16/04/2018 | |
##### Nithikan Srinakrung - Bam | |
##### DFL, FTSM, UKM | |
import numpy as np | |
def dimension(array,number_of_rows): | |
result = np.zeros([number_of_rows,len(array)]) | |
for i in range(number_of_rows) : | |
for n in range(len(array)): | |
result[i,n] = array[n] | |
return result | |
a = [2,3,4,5,6] | |
n = 99 | |
print(dimension(a,n)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment