midtermtwo2013key

greeting the message for today is hello 3 given

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: = ‘hello’ Show the result of entering the following into the Python Shell: >>> ‘greeting’ ‘greeting’ >>> greeting ‘hello’ >>>> print('The message for today is %s.' % (greeting)) The message for today is hello. (3) Given the following Python code: def skittles(): ''' print the number of skittles of each color no return value ''' ttl = input(‘how many skittles are there altogether? ‘) # user says 100 ttl = int(ttl) o = 5 g = o ** 2 y = ttl  ­ (o + g) print(‘skittles’ + ‘skittles’) # checkpoint 1 print(o, g, y, ttl) # final checkpoint When skittles is called – skittles() – and the user indicates there are 100 skittles total when asked, what will be printed at each checkpoint? checkpoint 1: skittlesskittles final checkpoint: 5 25 70 100 (4) Given the following Python code: def sort3(x, y, z): # sorts x, y, and z into ascending order # and returns the...
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 Oregon.

Ask a homework question - tutors are online