3D Array: Use python to solve this problem. We already know how to operate 2D arrays. Now we have to use 3D arrays in order to construct LCS with 3 parameters. Multidimensional array means multiple arrays of different dimensions or sizes can be held by a single array. We will learn about 3D arrays with an example. Suppose we want to store midterm and final marks separately of four different courses of three students in a single array. We can easily do it by using a 3D array. Python: for i in range(len(A)): print("Student: ",(i+1)) for j in range(len(A[i])): print("Course: ",(j+1)) print("Marks of Mid and Final: ") for k in range(len(A[i][j])): print(A[i][j][k],end=" ") print() print() OUTPUT: Student: 1 Course: 1 Marks of Mid and Final: 30 25 Course: 2 Marks of Mid and Final: 35 40 Course: 3 Marks of Mid and Final: 41 45 Course: 4 Marks of Mid and Final: 26 26 Student: 2 Course: 1 Marks of Mid and Final: 41 45 Course: 2 Marks of Mid and Final: 43 47 Course: 3 Marks of Mid and Final: 49 44 Course: 4 Marks of Mid and Final: 46 47 Student: 3 Course: 1 Marks of Mid and Final: 10 15 Course: 2 Marks of Mid and Final: 35 20 Course: 3 Marks of Mid and Final: 11 17 Course: 4 Marks of Mid and Final: 29 16
3D Array: Use python to solve this problem.
We already know how to operate 2D arrays. Now we have to use 3D arrays in order to construct LCS with 3 parameters. Multidimensional array means multiple arrays of different dimensions or sizes can be held by a single array. We will learn about 3D arrays with an example.
Suppose we want to store midterm and final marks separately of four different courses of three students in a single array. We can easily do it by using a 3D array.
Python:
for i in range(len(A)):
print("Student: ",(i+1))
for j in range(len(A[i])):
print("Course: ",(j+1))
print("Marks of Mid and Final: ")
for k in range(len(A[i][j])):
print(A[i][j][k],end=" ")
print()
print()
OUTPUT:
Student: 1
Course: 1
Marks of Mid and Final:
30 25
Course: 2
Marks of Mid and Final:
35 40
Course: 3
Marks of Mid and Final:
41 45
Course: 4
Marks of Mid and Final:
26 26
Student: 2
Course: 1
Marks of Mid and Final:
41 45
Course: 2
Marks of Mid and Final:
43 47
Course: 3
Marks of Mid and Final:
49 44
Course: 4
Marks of Mid and Final:
46 47
Student: 3
Course: 1
Marks of Mid and Final:
10 15
Course: 2
Marks of Mid and Final:
35 20
Course: 3
Marks of Mid and Final:
11 17
Course: 4
Marks of Mid and Final:
29 16
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 5 images