I have written the following code:
import numpy as np
n_rows = int(input("Enter number of rows:"))
n_columns = int(input("Enter number of columns:"))
print("Enter 2D array values---")
matrix = []
for i in range(n_rows):
a=[]
for j in range(n_columns):
a.append(int(input()))
matrix.append(a)
arr=np.array(matrix)
arr
if i input the following values this will give the following output:
array([[1, 2, 3],
[4, 5, 6]])
but i want first row of matrix to enter as string values like:
["John","Alex","Smith"]
and 2nd row of matrix as integer values like:
[50,60,70]
and then i want to get the following output:
Name: John , Marks: 50
Name: Alex , Marks: 60
Name: Smith, Marks: 70