Question: Question C 2 [ 1 0 marks ] Write your answer in the provided file A 2 Q 2 . py . Fill in your

Question C2[10 marks]
Write your answer in the provided file A2Q2.py. Fill in your name and student ID in the proper section.
Programming often involves implementing mathematical concepts through coding. In this question, you'll work with fundamental linear algebra operations, including matrix addition and multiplication. If you are unfamiliar with these concepts, please refer to resources such as GeeksforGeeks on Matrices before attempting the tasks.
Instructions:
1. Define a function: split_SID (str1)
- Description: This function accepts a string as input and returns a list of integers.
- Assumption: The input string will always consist of valid numerical text. No invalid input will be provided.
```
### Sample Output 1
>>> x = splitSID("0123456789")
>>> print(x)
[0,1,2,3,4,5,6,7,8,9]
### Sample Output 2
>>> x = splitSID("123")
>>> print(x)
[1,2,3]
```2. Define a function: factor_pairs (int1)
- Description: This function accepts an integer and returns a 2D list (nested list) containing pairs of factors of the input integer.
```
### Sample Output 1
>> y = factor_pairs(9)
\gg> print(y)
[[1,9],[9,1],[3,3]]
### Sample Output 2
>> y = factor_pairs(12)
>> print(y)
[[1,12],[12,1],[2,6],[6,2],[3,4],[4,3]]
### Sample Output 3
> y = factor_pairs(7)
>> print(y)
[[1,7],[7,1]]
```
- Note: Reverse pairs are included only if they differ. For instance, if the input is 9, include the pair \((1,9)\) but exclude \((3,3)\) if it's a duplicate.
3. Define a function: reshape_list_1d_to_2d(lst, rows, cols)
- Description: This function converts a 1D list into a 2D list (essentially a matrix) based on the provided number of rows and columns.
- Assumption: The provided rows and columns will always be valid and match the total number of elements in the original list.
```
### Sample Output 1
>>> z = reshape_list_1d_to_2d([1,2,3,4,5,6],3,2)
>>> print(z)
[[1,2],[3,4],[5,6]]
### Sample Output 2
>>> z = reshape_list_1d_to_2d([1,2,3,4,5,6],2,3)
>>> print(z)
[[1,2,3],[4,5,6]]
```
4. Define a function: find_dimensions_2d_list(lst_2d)4. Define a function: find_dimensions_2d_list(lst_2d)
- Description: This function accepts a 2D list (matrix) and returns a list with two elements: the number of rows and columns in the matrix.
- Assumption: The inner lists in the 2D list will always have the same number of elements.
```
### Sample Output 1
>>> a = find_dimensions_2d_list([[1,2,3,4,5,6,7,8,9]])
>>> print(a)
[1,9]
### Sample Output 2
>>> a = find_dimensions_2d_list([[1,2,3],[4,5,6],[7,8,9]])
>>> print(a)
[3,3]
### Sample Output 3
>> a = find_dimensions_2d_list([[1],[2],[3],[4],[5],[6],[7],[8],[9]])
>> print(a)
[9,1]
```
5. Define a function: matrix_multiplication(matrix1, matrix2)
- Description: This function multiplies two 2D lists (matrices) and returns a new matrix as a 2D list. If the matrices cannot be multiplied due to incompatible dimensions, the function returns None and prints a simple statement.
- Assumption: The inner lists in the 2D list will always have the same number of elements.
```
# Note: Matrix multiplication is possible only if the number of columns in the first matrix matches
the number of rows in the second.
# The result will have the number of rows from the first # matrix and columns from the second
matrix.
### Sample Output 1
>> b = matrix_multiplication([[1,2,3],[4,5,6]],[[7,8],[9,10],[11,12]])
$>> print(b)
[[58,64],[139,154]]
### Sample Output 2
>>> b = matrix_multiplication([[1,2,3],[4,5,6]],[[7,8],[9,10]])
>>> print(b)
Invalid. The number of columns in the first matrix must equal the number of rows in the second
matrix.
None
```6. Formulate the rest of your program according to the provided sample output. (user inputs are indicated with text highlighted in blue color)
```
### Sample Output: Case 1
This is the Question C2 of Assignment 2.
The submitted code is created by Chan Siu Ming. SID: 40202425.
In submitting this assignment, I understand the AI tools should be used as supporting purposes
instead of direct copy-and-paste.
Any suspicious submission may result in a deduction of marks or disqualification in this question.
My SID is 40202425, and after splitting it into individual integers, it becomes [4,0,2,0,2,4,
2,5].
There are 8 items on the list.
Available reconstruction 2-D sizes (rows x columns):
1: 1 x 8
2: 8 x 1
3: 2 x4
4: 4 x 2
```
For demonstration, the integers will be hard coded to be reconstructed into a \(2\mathbf{x}\mathbf{4}\) matrix: \([[4,0,2,0],[2,4,2,5]]\)
What is your student ID?01234567890
Your SID is 01234567890, and after splitting it into individual integers, it becomes [0,1,2,3,\(4,5,6,7,8,9,0]\).
There are 11 items on the list.
Available reconstruction 2-D sizes (rows \( x \) columns):
```
1: 1 x 11
2: 11 x 1
Please choose the option for reconstruction. Enter the integer representing that option:
You selected option [1], i.e.,1 x 11. The matrix becomes:
[[0,1,2,3,4,5,6,7,8,9,0]]
Let's try performing matrix multiplication between the two matrices, 1st x 2nd ...
Invalid. The number of columns in the first matrix must equal the number of rows in the second
matrix.
Unfortunately, matrix multiplic ```
### Sample Output: Case 2
This is
Question C 2 [ 1 0 marks ] Write your answer in

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!