This assignment will involve writing two small Python modules. These modules are similar to the examples from class (population estimation and reading level) in that they prompt the user for input values, perform calculations on those values, and display the results in a message. Your modules should follow the same basic style as the examples from class, with a comment block at the top documenting the purpose of the module, meaningful variable names, and readable I/O messages.
Note: this work must be entirely your own, with no outside assistance other than the instructor.
blink.py
)Note that the number of blinks should be rounded to the nearest integer. There should also be a blank line between the input prompts and the output message.
mortgage.py
)The formula for calculating the monthly mortgage payment is:
monthly payment = | loan • rate • (1+rate)^{months} |
(1+rate)^{months} ‐ 1 |
where loan is the loan amount, months is the loan term (in months), and rate is the monthly interest rate (i.e., the yearly rate divided by 12).
Your code should prompt the user for the loan amount, the loan term (in years), and the yearly interest rate. It should calculate and display the monthly payment and the total amount that will be paid over the term of the loan. For example,
The monthly payment should be rounded to the nearest penny. This can be accomplished by providing the round
function with a second input, specifying the maximum number of digits. For example, round(1.2364, 2)
evaluates to 1.24
. There should be no spaces between a dollar sign and the associated amount, but there should be a blank line between the input prompts and the output message.