# Variables #1 - what does the following code print? x = 34 y = 2-x x = x * -1 print x + y #2 a = 0 b = a + 6 b = b + b + 1 print a, b #3 - Prompt the user for his/her age and store #it in a variable age = input("Please enter your age: ") #4 - Prompt the user for his/her name name = raw_input("Please enter your name: ") #5 - Identify all the syntax errors in the #following function definition #define myFunkyFunction(int x) # printy x #6 - What are the values of a, b, and c # after the code executes? a = 256 b = 12 if a >= b * 20: c = a - b if c > 0: a = 0 else: b = 0 else: c = b * b #7 - Evaluate the following Boolean expressions to # True or False 1 > 0 1 < 53 2+3+1 == 5 7/2 <= 0 "Washington" != "Lee" True and False True and True and not(False) False or False or True True or False not(True) or False not(False) not(14 <= 0) or "Washington" != "Lee" 2*3 > 6 and 8 != 2*4 print True and (False or True) #8 - How many times does the following loop execute? x = 1 while x > 0: print x + x #9 - What is the final value of z? z = 0 i = 0 while i < 5: z = z + i i += 1 #10 - What sequence is printed by the following code? y = 1 while y < 5: print 2**y y += 1 #11 - What is the final value of t? t = 0 while t < 100: print t, t, t if t > 50: t = "hello!" break t += 1 #12 - Open-Book/Computer # Write the while loop that prints the first 1000 # multiples of 8 #13 - Open-Book/Computer # Define a function named squares(x) that takes one # x parameter and returns its square #14 - Write an infinite while loop