Exam 1- 2013

Be very clear with spacing line breaks etc note the

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: print to the screen when each of the following snippets of code is executed in IDLE? Be very clear with spacing, line breaks, etc. Note: the parts of this problem are independent. (a) a=2 print(a) (b) x=4 y = 1 + x ** 2 // 2 print(x, y) (c) a = 9 b=2 a += b print(a, b) CS 115 Exam 1, Spring 2013 Page 2 of 8 (d) for i in range(4): print(i) print("i") (e) q=0 if q < 2: print("dog") if q >= 0: print("cat") print("mouse") (f) a=4 while a < 20: a=a*2 print(a) CS 115 Exam 1, Spring 2013 Page 3 of 8 (g) q=0 if q < 2: print("dog") elif q >= 0: print("cat") else: print("mouse") (h) x = 10 for i in range(5): x=x+i print(x) (i) y = "hello...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online