Chapter 3 - Branching, While loops and programming Flashcards
pick a random number
random. randint(1, 6)
random. randrange(6) + 1 -> random number between 6 numbers(0, 1, 2, 3, 4, 5); if (6) + 1 -> (1, 2, 3, 4, 5, 6)
a combination of functions, combined for a specific purpose
module
access randint through the function
random.randint()
module.function
dot notation
taking one path instead of another
branching
an expression that is either True or False
condition
== equal to <= smaller or equal to >= bigger or equal to != different to
comparison operators
one or more lines with the same indentation
block
how many statements can be executed in an if-elif-else code
1, the first one where the condition is True (or if none evaluate to True then the else statement)
if statement but…
elif or else clauses
a value compared to other values in a condition
sentry variable (needs to be initialised before the loop)
simulate (go through) the code without running it
Tracing
which number /and string evaluate to False?
Zero 0(e. g. if money: === if money != 0) !negative numbers are True empty string ""
statement that returns you to the top of the loop
continue
statement to end a loop
break