Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Dr.

Sajida Parveen Fall-2022 CSE-3071

National Textile University


Department of Textile Engineering
Semester: FALL 2022
CSE3071 – Computer Programming

Due Date: December 22, 2022 (Thursday)

Instructions:
Your submission will not get any credit if:

• Submission is copied from any source i.e., internet or students.


• Submitted after due date.
• Submission does not open, or file is corrupt.

SOLVE THIS LAB PLAN USING ARRAYS

Task 1: Declare a 0-dimension array and print it.

Task 2: Declare a 1-dimension array and print it.

Task 3: Declare a 2-dimension array and print it.

Task 4: Declare a 3-dimension array and print it.

Task 5: Take this [1,2,3,4,5,6,7,8,9], calculate the square and save the result in new array.

Task 6: Take this array [[1,2,3],[4,5,6]] and multiply it with 2.

Task 7: Write a NumPy program to create a 3x3 matrix with values ranging from 2 to 10.

Expected Output:

[[ 2 3 4]

[ 5 6 7]

[ 8 9 10]]

Task 8: Replace all odd numbers in array [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] with -1 without changing array.

Task 9: Print the odd and even numbers in array [0,1,2,3,4,5,6,7,8,9]

Page 1 of 2
Dr. Sajida Parveen Fall-2022 CSE-3071

Task 10: Take two arrays: [[1,2,3] , [4,5,6]] and [[7,8,9],[10,11,12]], add/subtract them, save result in
new array, and print the result.

Task 11: Reshape this array [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] into 3 x 3

Task 12: Find the indexes where the value is 4: [1, 2, 3, 4, 5, 4, 4]

Task 13: Find the indexes where the value is even and odd in this array [1, 2, 3, 4, 5, 4, 4]

Task 14: Find the index [1,6,7,8,9] where the value 7 should be inserted to maintain ascending order

Task 15: Sort this array ['banana', 'cherry', 'apple']

Page 2 of 2

You might also like