week 4 - branching Flashcards
bool type
stores as True or False
___ and ___ expressions evaluate to bool types
relational and logical
relational operators
compare two things
!=
not equal
<=
less than or equal to
> =
more than or equal to
not
opposite of evaluated type
and
both need to be true for an and statement to evaluate to true
or
one or more needs to be true for or to evaluate to true
if branching format python
if (expression):
# code
else:
# code
what distinguishes branch code from the rest?
indent
multiple branches
elif (exp):
# code
if branch
branch that only operates if expression is true
if-else branch
two branches, if input doesn’t fit into if exp, then else is executed
if-elif-else
each branch of code is executed until one is true