Professional Documents
Culture Documents
Class: 10B
2D ARRAYS
array = [ [3,2,1], [2,3,4], [7,5,2] ]
print(array[2][1])
print(array[0][1])
Plonker", 23,12,32]]
print(grades) # displays the list.
print(grades[1][2]) # displays 22
grades[1].append(56) # adds 56 to billy
KEYWORDS: array, element, table, assigning, identifier
39) Write a program that converts the following table into a two-
dimensional array called ‘grades’:
Student name Grade1 Grade2 Grade3
Paste your code below: Alfie Little 24 32 5
Billy Bob Junior II 22 22 53
Mark Jones 43 54 23
King Plonker 23 12 32
40) Modify Mark Jones Grade2 to 76 from the previous question. You will
need the following: grades[index][index] = 76
Paste your code below:
41) Add ‘Grade4’ to your array with the following data: You will need the
following: grades[x].append(value) Student name Grade4
Alfie Little 37
Paste your code below: Billy Bob Junior II 99
Mark Jones 32
King Plonker 42
42) Add to your previous code “question” to calculate the average for grade1,
grade2, grade3, and grade4 for Alfie Little. Display the outcome.
Paste your code below:
43) This two dimensional array holds the current level each pupil is working
at.
• Develop a program that initialises the two dimensional array. Display the
array.
• Remove Emma Baldridge from the array as she no longer attends the
school then display the array. hint: x.remove
• Add a new student “Jonathan Pierce” and his current grade as “5+”.
x.append
• Display the new array. “Alex Chadwick” “7+”
“Seema Patel” “5-”
Fill the gaps on the next slide. “Dion Scott” “6-”
“Emma Baldridge” “8”
“Gareth Wild” “8+”
43)
Fill the gaps.