Nate Brunelle Today: Conditional Decision Statements CS1110 Nate Brunelle Today: Conditional Decision Statements
Questions?
Last Time Functions Default Arguments
Expression vs. Statement Expression: simplifies to a value 2 2+3 Amount_to_be_fancy(3**2) Statement: Does something x=3 print(‘Hello World!’)
Conditional decision Statement if boolean expression: action elif boolean expression: else:
Conditional decision Statement if boolean expression: action elif: another action else: yet another action 0 or more 0 or 1
Values and Types (not exhaustive) Operators -50 ,0 ,5, 30, 512 int 3+7, 3*7, 3-7, 3/7 0.5, 1.2, 0.333333 float +, *, -, /, //, %, **, compare ‘hi’, “hi”, ‘hello world! ✃’ str +, * int Print, input function print() True, False bool and, or, not
and, or, not examples x<2 and x>0 x<0 or x>2 not x>2 When all things are true x<0 or x>2 When any of the things are true not x>2 When the thing is false
and, or, not and or not True if all things are True False if any things are False or True if any things are True False if all things are False not True if the thing was False False if the thing was True