midtermtwo2013key

From turtle import def jumpsteps called

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: gt;’’’ (b) Edit increment to take a second parameter, which_greet, which will be a particular greeting (3 edits). For example, >>> greeting(‘Good morning’, ‘CIS 122’) ‘Good morning, CIS122’ >>> greeting(‘Hello’, ‘World’) ‘Hello, World’ (1) ‘’’Returns a personal greeting: <input greeting>, <input name>’’’ (2) def greeting(which_greet, name): (3) return(which_greet + ‘, ‘ + name) (c) What is the value of result after the following code is executed? >>> result = greeting(‘Ciao’, ‘Ducks’) (1) None (2) ‘Ciao’ (3) ‘Ciao, Ducks’ (4) ‘result’ (6) What will the output be when the following Python code is executed? from turtle import * def jump(steps): ''' called by turtle frame function ''' penup() forward(steps) pendown() def frame(sixth_side): ''’draw a frame with sides length 6 * sixth_side ''' forward(sixth_side) jump(sixth_side) forward(sixth_side * 2) jump(sixth_side) fd(sixth_side) lt(120) forward(sixth_side) jump(sixth_side) forward(sixth_side * 2) jump(sixth_side) fd(sixth_side) lt(120) forward(sixth_side) jump(sixth_side) forward(sixth_side * 2) jump(sixth_side) fd(sixth_side) lt(120) >>> frame(30...
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