hw6 - Suggested Homework #6 Suggested Homework #6 (for Quiz...

This preview shows pages 1–2. Sign up to view the full content.

Suggested Homework #6 Suggested Homework #6 (for Quiz #6 on 11/4/05) Problem 1: Suppose that the following was entered into the Python shell. For each entry, the interpreter responds with either: (a) the value of the object computed, (b) nothing, if it is an assignment (name binding), or the value computed is None , or, (c) an error message due to an exception. Fill in the blanks (" ___ ") with how the Python interpreter would respond if each of the below was entered in the sequence shown. Note that you could just enter this sequence into the interpreter and see what happens, but this is a luxury you will not have during the quiz. >>> 2 + 4.2 ________ >>> "this " + "is"*4 + "easy" ________ >>> (1,2.2,"a") + (3,4.5,"b") ________ >>> z = ("a",3) * 5 ________ >>> q = z[3][0] * z[2][1] ________ >>> y = [1,2,"3",[4,6]] + ["a","b","c"] ________ >>> y[2:6] ________ >>> y[3:] ________ >>> y[3][:] ________ >>> i,p = 1,1 while (i<5): i,p = i+1,p*i http://www.cs.ucsd.edu/classes/fa06/cse130/shw/shw5.html (1 of 4) [2/13/2008 5:23:41 PM]

This preview has intentionally blurred sections. Sign up to view the full version.

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

This homework help was uploaded on 02/14/2008 for the course CSE 130 taught by Professor Jhala during the Fall '06 term at UCSD.

Page1 / 4

hw6 - Suggested Homework #6 Suggested Homework #6 (for Quiz...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online