I am beginner in python. This is a code I had written in C. I am trying to convert it to python.
int arr[studentCount][subjectCount][2];
const int DISTINCTION = 4;
const int FIRST_DIVISION = 3;
const int SECOND_DIVISION = 2;
const int PASS_CLASS = 1;
const int FAIL = 0;
for(int i=0 ; i<studentCount ; i++) {
for(int j=0 ; j<subjectCount ; j++) {
//taking input in i,j,0
printf("Enter marks of student %d subject %d - ",i+1,j+1);
scanf("%d",&arr[i][j][0]);
//logic of result
//giving grades in i,j,1 based on the marks entered in i,j,0
if(arr[i][j][0]>=70)
arr[i][j][1]=DISTINCTION;
else if(arr[i][j][0]>=60)
arr[i][j][1]=FIRST_DIVISION;
else if(arr[i][j][0]>=50)
arr[i][j][1]=SECOND_DIVISION;
else if(arr[i][j][0]>=40)
arr[i][j][1]=PASS_CLASS;
else
arr[i][j][1]=FAIL;
}
}
This is where I reached but can't under stand how do I take input in the 3d array
arr = np.zeros((studentCount,subjectCount,2));
print arr;
for (i in range(studentCount)):
for(j in range(subjectCount)):
#taking input in the arr
In the code I am basically taking input of marks of studentCount students in subjectCount subjects and then assigning them grades according to the marks. So here I don't want to take the input in a line and all the previous answers I searched show the inputs taken in a line. If I do that I will be taking the input of grades by user and hence defeating the purpose of the code. Please Help!