Exam 1_Spring 2011

B print the following output month month month month

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: thing printed will be 305. (b) Print the following output: Month Month Month Month Month Month Month Month Month Month Month Month 1 has 31 days. 2 has 28 days. 3 has 31 days. 4 has 30 days. 5 has 31 days. 6 has 30 days. 7 has 31 days. 8 has 31 days. 9 has 30 days. 10 has 31 days. 11 has 30 days. 12 has 31 days. 7. Write a Python graphics based program that requires the user to click on three points in its window and then draws the triangle connecting those points. 1 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(10,15): f, s = s, f + s print("f =", f, " s=", s) (b) n=3 k=4 for c in range(5): n=n+k 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() win.setCoords(0, 0, 100, 100)...
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