Level 1: Array Creation
1.
Create a NumPy array containing:
[10, 20, 30, 40, 50]
2.
Create an array of numbers from 1 to 20.
3.
Create an array of even numbers from 2 to 50.
4.
Create an array of 10 zeros.
5.
Create an array of 15 ones.
6.
Create an array:
[5, 5, 5, 5, 5, 5]
without typing 5 six times.
Level 2: Array Properties
Given:
arr = [Link]([[1,2,3],
[4,5,6],
[7,8,9]])
7.
Print:
shape
size
ndim
dtype
8.
Find total number of elements.
9.
Find number of rows and columns.
Level 3: Indexing & Slicing
Given:
arr = [Link]([10,20,30,40,50,60,70,80])
10.
Print:
30
11.
Print:
[20,30,40]
12.
Print last 3 elements.
13.
Reverse the array using slicing.
Level 4: Array Operations
Given:
a = [Link]([1,2,3,4,5])
b = [Link]([10,20,30,40,50])
14.
Add both arrays.
15.
Subtract both arrays.
16.
Multiply both arrays.
17.
Divide b by a.
18.
Square every element of a.
19.
Find cube of every element of a.
Level 5: Mathematical Functions
Given:
arr = [Link]([5,10,15,20,25])
20.
Find:
sum
mean
max
min
21.
Find median.
22.
Find standard deviation.
23.
Find index of maximum element.
24.
Find index of minimum element.
Level 6: 2D Arrays
25.
Create:
[[1 2 3]
[4 5 6]
[7 8 9]]
26.
Print second row.
27.
Print third column.
28.
Print:
29.
Print:
[[1 2]
[4 5]]
30.
Find sum of each row.
Level 7: Reshape
31.
Create array:
[1,2,3,4,5,6,7,8,9,10,11,12]
Convert it into:
3×4
32.
Convert same array into:
2×6
33.
Flatten:
[[1,2,3],
[4,5,6]]
into:
[1,2,3,4,5,6]
Level 8: Boolean Masking
Given:
arr = [Link]([12,45,7,89,34,22,100])
34.
Print all elements greater than 30.
35.
Print all even numbers.
36.
Count how many numbers are greater than 50.
37.
Replace all numbers less than 20 with 0.
Level 9: Mini Challenges
38.
Find second largest number in a NumPy array.
39.
Remove duplicate values from:
[1,2,2,3,4,4,5,6,6]
40.
Check whether an array contains a particular number entered by user.
41.
Count frequency of each element.
42.
Find all prime numbers between 1 and 100 using NumPy.