Assignment 17
NumPy Mathematical Operations & Statistical Functions Challenge
Level 1 : Import the NumPy library using the standard alias (np) and print its version.
Level 2 : Create the following two arrays:
a = [10, 20, 30] b = [1, 2, 3]
Perform addition (a + b) and print the result.
Level 3: Using the same arrays, perform:
- Subtraction
- Multiplication
- Division
Print all outputs.
Level 4 : Create the array:
[4, 9, 16, 25]
Find the square root of each element using np.sqrt().
Level 5: Create the array:
[2, 4, 6, 8]
Find the square of every element using np.power().
Level 6 : Create the array:
[-10, -5, 0, 5, 10]
Find the absolute value of every element using np.abs().
Level 7 : Create the following decimal array:
[1.2345, 2.6789, 3.9876]
Round every value to 2 decimal places using np.round().
Level 8 : Create the array:
[10, 20, 30, 40]
Calculate and print:
- Sum
- Product
- Mean
Level 9 : Create the array:
[15, 25, 35, 45, 55]
Find:
- Minimum Value
- Maximum Value
Level 10 : Using the same array, print:
- Index of Minimum Value
- Index of Maximum Value
Level 11 : Create the array:
[12, 18, 25, 30, 40]
Calculate:
- Mean
- Median
- Standard Deviation
Level 12: Create the array:
[5, 10, 15, 20]
Find:
- Cumulative Sum (np.cumsum())
- Cumulative Product (np.cumprod())
Level 13 : A teacher has the following student marks:
[65, 72, 81, 90, 78]
Calculate:
- Average Marks
- Highest Marks
- Lowest Marks
- Standard Deviation
Level 14 : A shop records daily sales:
[1000, 1500, 2000, 2500, 3000]
Find:
- Total Sales
- Average Sales
- Cumulative Sales
Level 15 : A company records monthly profits:
[25000, 30000, 28000, 35000, 40000]
Find:
- Maximum Profit
- Minimum Profit
- Index of Maximum Profit
- Index of Minimum Profit
Level 16: Create two arrays:
a = [5, 10, 15] b = [2, 4, 6]
Perform:
- Addition
- Subtraction
- Multiplication
- Division
- Power
Level 17 : Create the array:
[100, 200, 300, 400, 500]
Print:
- Mean
- Median
- Variance
- Standard Deviation
Level 18 : Create the array:
[2, 4, 6, 8, 10]
Calculate:
- Sum
- Product
- Square Root
- Square
Level 19 : Generate the following array using np.arange():
1 to 20
Calculate:
- Sum
- Mean
- Maximum
- Minimum
Level 20 : Generate 10 equally spaced values between 0 and 100 using np.linspace().
Calculate:
- Mean
- Median
- Standard Deviation
Level 21 : Create the array:
[9, 16, 25, 36, 49]
Find:
- Square Root
- Sum
- Mean
Level 22 : A cricket player scored:
[45, 60, 75, 90, 110]
Calculate:
- Total Runs
- Average Runs
- Highest Score
- Lowest Score
Level 23: A temperature sensor recorded:
[28, 30, 29, 31, 32, 30]
Find:
- Average Temperature
- Maximum Temperature
- Minimum Temperature
- Standard Deviation
Level 24 : Create the array:
[3, 6, 9, 12]
Calculate the cumulative sum and cumulative product.
Level 25 : Create two arrays:
a = [1, 2, 3, 4] b = [5, 6, 7, 8]
Perform all arithmetic operations and print the results.
Level 26 : Create an array containing the first 10 natural numbers.
Calculate:
- Sum
- Product
- Mean
- Median
Level 27 : Create an array of your five favorite numbers.
Print:
- Maximum
- Minimum
- Mean
- Standard Deviation
Level 28 : Create a NumPy array of 10 random integers (between 1 and 100).
Find:
- Maximum
- Minimum
- Mean
- Median
- Standard Deviation
Level 29 : Create an array:
[50, 80, 20, 100, 60]
Print:
- Maximum Value
- Minimum Value
- Index of Maximum Value
- Index of Minimum Value
- Cumulative Sum
Level 30 : Create your own NumPy program that demonstrates all the concepts learned in this lesson. Your program must include:
- Arithmetic Operations
- Mathematical Functions
- Aggregate Functions
- Minimum & Maximum
- Mean
- Median
- Standard Deviation
- Cumulative Sum
- Cumulative Product
Print all outputs with proper labels.





