TK Study

Multiple choice › 2D arrays (Python)

2D arrays (Python)

1. 2D arrays (Python)

A school timetable has five periods each day (Monday to Friday). If the timetable is stored as a 2D array, what is the correct Python snippet for accessing the subject on Monday Period 3?

  1. Timetable[2]
  2. Timetable[1,4]
  3. Timetable[0][2]
  4. Timetable[1].Subject
Answer

C

Timetable[0][2]: day index 0 = Monday, period index 2 = Period 3.