AP CSP Exam All Units 2024
Assignment: a ← 5
Evaluates expression and then assigns a duplicate of the result to the variable a.
DISPLAY(expression)
Displays the fee of expression, observed by way of a area.
Previous
Play
Next
Rewind 10 seconds
Move ahead 10 seconds
Unmute
zero:01
/
zero:15
Full display screen
Brainpower
Read More
INPUT ( )
Accepts a price from the person and returns the input fee.
Arithmetic Operators
Symbols (+, -, *, /) used to perform mathematics on a and b.
A MOD b
Evaluates to the remainder whilst a is divided by way of b. Looks like this in Python 3p.C5
RANDOM(a, b)
Generates and returns a random integer from a to b, consisting of a and b.
,Relational Operators
Symbols (=, ≠, >, <, ≥, ≤) used to test the relationship between variables or values.
NOT condition
Evaluates to true if circumstance is fake; otherwise evaluates to false.
Condition1 AND condition2
Evaluates to true if both condition1 and condition2 are actual; otherwise evaluates to false.
Condition1 OR condition2
Evaluates to genuine if condition1 is true or if condition2 is proper or if each condition1 and
condition2 are genuine; in any other case evaluates to fake.
List Operations
Various operations (e.G., INSERT, APPEND, REMOVE) that may be carried out on lists.
AList ← [value1, value2, value3, ...]
Creates a new list that consists of the values value1, value2,
value3, and ... At indices 1, 2, three, and ...
Respectively and assigns it to aList.
AList[i]
Accesses the element of aList at index i.
X ← aList[i]
Assigns the value of aList[i] to the variable x.
Procedures
Defines a named block of code that may be referred to as and performed. In python we referred
to as this a feature.
, Robot
Describes the motion and sensing capabilities of a robot, such as MOVE_FORWARD,
ROTATE_LEFT, ROTATE_RIGHT, and CAN_MOVE.
REPEAT UNTIL(situation)
Repeats commands till the Boolean expression circumstance is authentic.
AList ← [ ]
Empty listing
aList ← bList
Assigns a copy of the list bList to the list aList.
For instance, if bList contains [20, 40, 60],
then aList may even comprise [20, 40, 60] after the
undertaking.
AList[i] ← x
Assigns the cost of x to aList[i].
AList[i] ← aList[j]
Assigns the cost of aList[j] to aList[i].
INSERT(aList, i, cost)
Any values in aList at indices more than or equal to i are
shifted one position to the right. The length of the listing is increased via
1, and cost is located at index i in aList.
APPEND(aList, fee)
The duration of aList is multiplied by 1, and cost is placed at
the end of aList.
REMOVE(aList, i)
Removes the item at index i in aList and shifts to the left
any values at indices extra than i. The period of aList is