CS 111 - 3/6/18 For Today, Tuesday 3/6/18, Office Hours for Prof. Troy will be held a bit earlier than normal: Office Hours will be held: 11am - 12:20pm in 919 SEO. (I need to attend a class at 12:30.) ======================== Using Frequency Code: BB What is the value of z when this code is finished executing? x = 15 # x: 15 z = 0 # z: 0 if ( x < 10 ) : z = 1 elif ( x < 20 ) : z = 2 elif ( x < 30 ) : z = 3 else: z = 4 a. 4 b. 3 c. 2 d. 1 e. 0 What is the value of z when this code is finished executing? x = 15 # x: 15 z = 0 # z: 0 2 3 if ( x < 10 ) : z = 1 if ( x < 20 ) : z = 2 if ( x < 30 ) : z = 3 else: z = 4 a. 4 b. 3 c. 2 d. 1 e. 0 =========================================== Boolean Operators (Continued) For OR: the result of the boolean expression is TRUE when EITHER operand is TRUE otherwise the result is FALSE // code for a value outside of a range x = input ("Enter in an integer value") if ( x < 10 ) or ( x > 20 ): print ("The value is outside of the range") Truth Table: (assume x and y are boolean values) x y || x OR y x AND y =========================================== true true || true true true falue || true false false true || true false false false || false false x = 1 y = 2 z = 3 if ( x < y ) and ( z < y ): z = 7