Question
1. Please write the following code in python 3. Also, please anser all quetions and share code. Write a Python function `simulate_revenue(average, std_dev, months)`. -
1. Please write the following code in python 3. Also, please anser all quetions and share code.
Write a Python function `simulate_revenue(average, std_dev, months)`. - it produces simulated revenue data according to a normal distribution with shape parameterized by `average` and `std_dev`, for a given number of months. - It returns a list of length `months`. - Round each item to the nearest cent. No fractions of a cent allowed.
Use `simulate_revenue` to generate two lists of random numbers which model potential revenue:
1. one list `before` with 24 months of revenue using the current mean and standard deviation, 2. another list `after` with 12 months of revenue using the predicted mean and standard deviation.
Then, concatenate `before` and `after` to produce a third list `all_months` containing the revenue of all 48 months.
---
Write a function `print_monthly_revenue(revenue, name)` that prints an arbitrary list to the screen, with these formatting requirements: - round each number *when printing* to the nearest $100. - do not modify the original list. - prints a two-column output, with `month: revenue` (the month is implicitly given). Pad the month value so it is always of width 2. - right-align the revenue value
Example: `print_monthly_revenue(before, "before")` produces ``` Revenue for period 'before'
Mo: revenue ----------- 01: 123100 02: 98288 ... ```
Call `print_monthly_revenue` on each of your concatenated list, and be sure to commit the output.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started