when(STARTED){
openSpots=0;
i=0;
j=0;
parkingLot=[
[0,0,0,0,0],
[0,2,1,1,2],
[0,1,1,2,1],
[0,0,0,0,0],
[0,1,2,2,1]
];
while(i<5){
while(j<5){
if((parkingLot[i][j]==1)){
openSpots=(openSpots+1);j=j+1;}else{
j=j+1; } } i=i+1;
j=0;
}Brain.Screen.print(“Number of open”);
Brain.Screen.newLine();
Brain.Screen.print("parking spots: ");
Brain.Screen.print(openSpots);
}
I copied the code from the student computer. It had windows that I couldn’t close or move. This is the code from the CSE course that I am teaching. Line 15 has an extra pair of parentheses, but the student told me that they did not type them there.
Here is another student’s code from today:
The while loops on line 12 & 13 are not right.
Line 14 has the start of some block pseudocode and it ends on line 19.
when(STARTED){
openshots=0;
i=0;
j=0;
parkinglot=[
[0,0,0,0,0],
[0,2,1,1,2],
[0,1,1,2,1],
[0,0,0,0,0],
[0,1,2,2,1]
];
while((i<5)){
while((j<5)){
n /glot[i][i
openshots=(openshots+1);
j=(j+1);
}else{
j=(j+1);
}/
} i=(i+1);
j=0;
}Brain.Screen.print(Number of open);
Brain.Screen.newLine();
Brain.Screen.print(parking spots: );
Brain.Screen.print(HELLO);
}