Class X - AI (417) Practical File 2024-25
Class X - AI (417) Practical File 2024-25
ID number : 22000
INDEX
PART - B
Program-1:
Source-Code:
import numpy as np
python_list = [1, 2, 3, 4, 5]
numpy_array = np.array(python_list)
Output:
Python List: [1, 2, 3, 4, 5]
NumPy Array: [1 2 3 4 5]
3
Program-2:
Source-Code:
list1 = [1, 2, 3]
list2 = [4, 5, 6]
Output:
List 1: [1, 2, 3]
List 2: [4, 5, 6]
Program-3
Source-Code:
import numpy as np
print("3x3 Matrix:")
print(matrix)
Output:
Program-4:
Source Code:
my_list = [1, 2, 3, 4, 5]
value_to_append = 6
my_list.append(value_to_append)
Output:
Updated List: [1, 2, 3, 4, 5, 6]
6
Program-5:
Source-Code:
import numpy as np
print("2D Array with 3 rows and 4 columns filled with ones:") print(array)
Output
2D Array with 3 rows and 4 columns filled with ones:
[[1 1 1 1] [1 1 1 1] [1 1 1 1]]
7
Program-6:
Get all elements the fourth element from the following array. arr=[‘den’,
‘pen’, ‘hen’, ‘ren’, ‘lem’, ‘men’]
Source-Code:
fourth_element = arr[3]
Output
Program-7:
Get first, third and fourth elements and add them from the
following array. arr = [34,56,76,89,70,67]
Source-Code:
first_element = arr[0]
third_element = arr[2]
fourth_element = arr[3]
Output
The sum of the first, third, and fourth elements is: 199
9
Program-8:
Source Code:
import pandas as pd
data = { "Name": ["Sanjeev", "Keshav", "Rahul"], "Age": [37, 42, 38], "Designation":
["Manager", "Clerk", "Accountant"] }
df = pd.DataFrame(data)
print(df)
Output:
Name Age Designation
0 Sanjeev 37 Manager
1 Keshav 42 Clerk
2 Rahul 38 Accountant
10