T7 - Sequence/Selection and Iteration Flashcards
Three operators used in Boolean expressions?
AND, OR, NOT
3 basic control structures used in programming:
Sequence, selection and iteration
Sequence:
The statements are executed
one by one in the order they are written
Selection -
next statement to be executed depends on whether the condition being tested is True or False
selection eg
Eg if statements (allow different branches to be executed based on the result of a Boolean expression)
==
equal to
!=
not equal to
>
greater than
greater than or equal to
> =
<
lesser than
lesser than or equal to
<=
AND
return as true if both conditions are true
OR
returns as true as long as one is true
NOT
returns the opposite value
Random numbers:
in Python,
import random to access library (numbers)
or
random.randint(0, 100) to generate range