TK Study

Past questions › sample-q21b

2025 5 marks Python / code The Software Engineering Project (Year 12) Python: subroutines, lists, loops

NESA HSC Software Engineering Sample Examination + Marking Guidelines (official, 2025)

At a school each student studies five subjects; five periods each day; each period is a different subject; the subject shifts to a different period each day so each subject appears in all five periods during the week. Example: Monday P1 English, P2 Software, P3 Drama, P4 Science, P5 Sport; Tuesday P1 Sport, P2 English, ... Write a Python program (using subroutines) that prints the timetable as: Monday / Period 1: English / Period 2: Software ... for all five days. Start with: subjects = ["English", "Software", "Drama", "Science", "Sport"]. Different students may study different subjects; the program will be used by changing the first line only. (5 marks)

Marking criteria

5: Substantially correct Python program that places each subject in the correct period; displays all 5 days; provides appropriate subroutines; programmatically builds the timetable. 4: Most requirements. 3: Some requirements. 2: One requirement. 1: Some understanding.

Sample answer

subjects = ["English", "Software", "Drama", "Science", "Art"] NUM_DAYS = 5 NUM_PERIODS = 5 DAYS_OF_WEEK = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"]

def create_timetable(subjects): timetable = [] for day in range(NUM_DAYS): periods = [] for period in range(NUM_PERIODS): periods.append(subjects[(period - day) % NUM_PERIODS]) timetable.append(periods) return timetable

def print_timetable(timetable): print() for day in range(NUM_DAYS): print(f"{DAYS_OF_WEEK[day]}") for period in range(NUM_PERIODS): print(f"\tPeriod {period+1}: {timetable[day][period]}") print()

timetable = create_timetable(subjects) print_timetable(timetable)

Question page · Practise and get marked