CSC 161 Fall 2022 - Homework 12 (10 pts. total)
Assigned Tue Nov 29, due Tue Dec 6
I. Answer the following questions from the Fundamentals of Python Programming text (available on Moodle) in a single Microsoft Word file. Submit on Moodle
using the filename hw12-LastName.doc (where LastName is replaced by your last name):
[ 1 pt. ] Read Sections 4.9-4.10. Then, answer question 17a on pages 110-111.
[4 pts.] Read Sections 5.1-5.3 & 5.7. Then, answer questions 2, 3, 13b, and 15g on pages 150-152.
II. Answer the following question in a Python Editor file. To receive any credit for this question, the filename & your first and last name must appear
as comments at the top of the file. Submit on Moodle using the filename hw12-squares-LastName.py (where LastName is replaced by your last name):
[2 pts.] Write a Python program with a for
loop that produces the following output:
1 4 9 16 25 36 49 64 81 100 121 144
III. Answer the following question in a Python Editor file. To receive any credit for this question, the filename & your first and last name must appear
as comments at the top of the file. Submit on Moodle using the filename hw12-doublingTime-LastName.py (where LastName is replaced by your last name):
[3 pts.] Write a program that uses a while
loop to determine how long it takes for an investment to double at a given interest rate. The input will be an annualized interest rate, and the output is the number of years it takes an investment to double. Note: The amount of the initial investment does not matter; you can use $1. (Have the program return a whole number of years, so whether the doubling time is 15.2 years or 15.7 years, your program should return 16 years either way.) [MUST show Steps 1-3 of the Software Development Process as commented out lines in your file. Make sure to Run the program on
different inputs and make sure you get the expected output in the Shell window in all cases.]
Last Modified: 11/29/22