Exam 1_Spring 2011

# Exam 1_Spring 2011

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: he variables as they change. mon = 2 tue = (mon + 4) tue = tue - 3 wed = mon % 2 thu = mon ** 3 wed = thu = mon thu = mon - 2 * tue = wed * mon mon, wed = wed, %2 +2 tue mon 3. Write the following formulas in Python: (a) ave = a+b+c+d 4 (b) area = 3(2 + apothem = √ 3)side2 2area 12side 4. Write for loop based Python code to calculate: (a) The product of all the integers from 2 to 50. (b) 2200 . 5. Write a Python graphics based program that requires the user to click on two points in its window. The program then draws a triangle formed by those two points and the origin. 6. Write for loop based Python code to do the following: (a) Print out the multiples of 8 from 240 to 800 inclusive. Note: The ﬁrst thing printed will be 240 and the last thing printed will be 800.) (b) Print the following output: Class Class Class Class Class Class Class Class Class 1 2 3 4 5 6 7 8 9 starts starts starts starts starts starts starts starts starts in in in in in in in in in 2 minutes. 12 minutes. 6 minutes. 3 minutes. 13 minutes. 31 minutes. 21 minutes. 22 minutes. 6 minute...
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