Numpy Flashcards

1
Q

How do you import numpy?

A

import numpy as np

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Create an array of 8 zeros for variable a

A

a = np.zeros(8)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Create an array with 3 rows and 5 columns

A

a.shape(3, 5)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How would you get the first element of an array “a”?

A

a[0]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How would you get the last element of an array “b”?

A

b[-1]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How would you get all the elements of array “d”?

A

d[:]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How would you get the greatest number from an array?

A

my_array.max()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How would you get the smallest number from an array?

A

my_array.min()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly