Question: Problem 2: Pennies for Pay Write a function that takes one integer as the parameter, the integer indicates the number of days. The function calculates

Problem 2: Pennies for Pay Write a function that takes one integer as the parameter, the integer indicates the number of days. The function calculates the amount of money a person would earn over the number of days if his or her salary is one penny the first day, two pennies the second day, and continues to double each day. The function should return a list where each element is how much money they have on that day. For example, the element at index 0 should be '$0.01' as they made 1 penny on the first day. The element at index 1 should be $0.03' because they earned 2 pennies on the second day plus the penny they earned on the previous day. The output should be displayed in a dollar amount, not the number of pennies. def pennies_for_pay (n_days): print(pennies_for_pay (12)) # ['$0.01', '$0.03', '$0.07', '$0.15', '$0.31', '$0.63', '$1.27', '$2.55', '$5.11', '$10.23', '$20.47', '$40.95']
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
