+ 3

How to define an array in Python and how an array is different from a list?

I found that notation for array and list is same in python, but performing operation like a=array([1,2,3]) a/2 didn't works as same ...

19th Jun 2017, 4:20 AM
snoɯʎuou∀
snoɯʎuou∀ - avatar
1 Antwort
+ 5
Install NumPy: https://scipy.org/install.html Creating an array: import numpy as np myArray = np.array([1,2,3]) List pros: - flexible - can be heterogeneous Array pros: - array of uniform values - homogeneous - compact (in size) - efficient (functionality and speed) - convenient
19th Jun 2017, 4:52 AM
Tim