midtermtwo2013key

1 101 99 b what is printed at checkpoint 2 1 99 101

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: sorted list tmp = max(x, y) x = min(x, y) y = tmp print(x, y, z) # checkpoint 1 tmp = max(y, z) y = min(y, z) z = tmp print(x, y, z) # checkpoint 2 tmp = max(x,y) x = min(x,y) y = tmp print(x, y, z) # final checkpoint After entering the following into the Python Shell: >>> result = sort3(101, 1, 99) a) What is printed at checkpoint 1? 1 101 99 b) What is printed at checkpoint 2? 1 99 101 c) What is printed at the final checkpoint? 1 99 101 d) What is the value of result? (1) None (2) 1 (3) 99 (4) ‘result’ (5) Given the following Python code: def greeting(name): ''' What does this function do? ''' return('Hello, ' + name) (a) Write the docstring for greeting: ‘’’Returns a personal greeting: Hello, <input name&...
View Full Document

This note was uploaded on 02/12/2014 for the course CIS 122 taught by Professor Staff during the Spring '08 term at University of Oregon.

Ask a homework question - tutors are online