This preview shows page 1. Sign up to view the full content.
Unformatted text preview: for n in range(10, 100, 10):
for n in range(10, 100, 10):
main() 10. Write a complete program that uses a loop to help ask the user for the quantity and cost of each of
10 items. The program should then print out the total cost.
An example run of the program should look like:
Item 10: -> 3
-> 5 2 Enter quantity -> 6
Your total cost is: 201.18 3 Lehman College, CUNY CMP 230 Exam 1, Version 1 Spring 2011 1. Write Python code that prompts the user for the diameter of a circle, and prints out the circumference
of the circle. Useful formulas: circumf erence = π · diameter
2. Trace the Python code below, i.e. indicate the state of the variables as they change.
mon = 7
tue = (mon + 6)
tue = tue + 3
wed = mon % 4
thu = mon ** 2
View Full Document
- Fall '13