דלג לתוכן

The exam reference sheet: lists and the robot

English

The exam's own pseudocode

  • The AP CSP exam does not use Python. Its questions are written in the Exam Reference Sheet language, and you get the sheet in the exam.
  • Most of it maps straight onto Python: ← is =, DISPLAY(x) is print(x), FOR EACH item IN aList is for item in a_list:.
  • Two parts need practice: the list procedures, where the first item is index 1, and the robot on a grid.
Reference sheet Python
aList[1] (the first item) a_list[0]
APPEND(aList, value) a_list.append(value)
INSERT(aList, i, value) a_list.insert(i - 1, value)
REMOVE(aList, i) a_list.pop(i - 1)
LENGTH(aList) len(a_list)
REPEAT n TIMES { } for _ in range(n):
REPEAT UNTIL (condition) { } while not condition:
RANDOM(a, b) random.randint(a, b)

היכנס או צור חשבון

IGCSE, A-Level & AP