== What does this condition evaluate to? (True or False) and (False or False) False == What value does this expression evaluate to? 1 + 3 * 7 22 What value does this expression evaluate to? (1 + 3) * 7 28 == Suppose you want to print 'yes' if the value of variable x is between 0 and 10 (inclusive). The following code is not correct. Please fix it. if x >= 0 and <= 10: print('yes') Ans: if x >= 0 and x <= 10: print('yes') == # Reminder: range(0,3) returns a sequence from 0 through 2. def mystery(x): y = 0 z = x for i in range(0,3): print("i =", i) if i > 1: y = y + x z = z + 1 return y y = 5 x = mystery(y) print("Result:",x) Trace the variable values during execution of this program. Specifically, for each underline in the table below, fill in the value of that variable after the line has executed, or write `NR' (for `not reached') if that line was not executed. during iteration 1 2 3 y = y + x mystery.y __NR___ __NR__ __5____ z = z + 1 mystery.z ___6___ ___7___ __8____ Ans: z after z = z + 1 6 z after z = z + 1 7 z after z = z + 1 8 Note: this question did not ask about the output! ===== Give the output of the following program: def fun1(x): print ("!!",x * 2) print (fun2(x * 2)) return x * 2 def fun2(y): print("inside fun2, y is", y) return y - 1 def main(): print ("Splat") print ("Calling fun1 now") print ("fun1(5) is",fun1(5)) main() Ans: Splat Calling fun1 now !! 10 inside fun2, y is 10 9 fun1(5) is 10 ==== Write the function specified below. def num_vowels(s): '''Return the number of vowels in string s. The letter ``y'' is not treated as a vowel.''' count = 0 for char in s: if char in ``aAeEiIoOuU'': count = count + 1 return count === Assume the following functions have already been defined: def remove_rightmost_digit(num): '''num: an int. return num with the rightmost digit removed. E.g. remove_rightmost_digit(5432) returns 543 If num has only one digit, return 0''' def get_rightmost_digit(num): '''num: an int. return the rightmost digit of num. E.g. remove_rightmost_digit(5432) returns 2 ''' Assume that num has been assigned an int that is at least 4 digits long. Write code to extract and print the 3rd digit from the right. For example, if num is 45678, your code should print 6. Ans: num = remove_rightmost_digit(num) num = remove_rightmost_digit(num) digit = get_rightmost_digit(num) print(digit)