how to make an array python
#arrays and lists are different
#numpy arrays are faster
this_is_a_list = [1, 2, 3]
import numpy #is you do not have it do pip install numpy
this_is_an_array = numpy.array([1, 2, 3])
how to make an array python
#arrays and lists are different
#numpy arrays are faster
this_is_a_list = [1, 2, 3]
import numpy #is you do not have it do pip install numpy
this_is_an_array = numpy.array([1, 2, 3])
python numpy array
import numpy as np
ary=np.array([1, 2, 3, 4])
print(ary[0]) # 1
print(ary[2]) # 3
print(ary[::2]) # array([1, 3])
np.array
x = np.array([ [67, 63, 87],
[77, 69, 59],
[85, 87, 99], # Creates an array, with arrays
[79, 72, 71],
[63, 89, 93],
[68, 92, 78]])
# its shape is [6,3] | 6 beeing its "height" and 3 its "width"
# if you want to to get this inffo about this array you can search for it
#just like you were searching for itens in an array, like:
fatness_of_the_array-x = x.shape[1] # 1 is refering to the width commented earlier
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us