Exam 1_Spring 2011

Street street street street street street street 7

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: hing printed will be 195 and the last thing printed will be 500.) (b) Print the following output: Stop Stop Stop Stop Stop Stop Stop Stop 1 2 3 4 5 6 7 8 is is is is is is is is 207 200 190 181 175 168 161 145 street. street. street. street. street. street. street. street. 7. Write a Python graphics based program that requires the user to click on one points in its window. The program then draws a 30 by 30 square with the clicked point as the upper right corner. 10 8. Trace the following Python code, i.e. indicate the state of the variables as they change and what output is printed to the screen: (a) f=3 s=5 for i in range(11, 16) f, s = s, f + s print("f =", f, " s=", s) (b) n=3 k=2 for c in range(5): n=n+k/2 k=3*k print("n =", n, " k = ", k) 9. Draw the output that would be displayed in the program’s window if the following Python graphics based program were executed: from graphics import * def main(): win = GraphWin("Picture", 400, 400) win.setCoords(0,0,100,100) Line(Point(0,0), Line(Point(0,100), Line(Point(0,50), Line(Point(50,0...
View Full Document

This document was uploaded on 03/24/2014 for the course CMP 230 at Lehman College.

Ask a homework question - tutors are online