Answer simulation questions and get solution in Python

1 answer below »
Answered 1 days AfterApr 25, 2021

Answer To: Answer simulation questions and get solution in Python

Vicky answered on Apr 27 2021
153 Votes
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"
\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"
Vaccine Demand
0782996
1656583
21650651
3116585
42690810
\n",
"
"
],
"text/plain": [
" Vaccine Demand\n",
"0 782996\n",
"1 656583\n",
"2 1650651\n",
"3 116585\n",
"4 2690810"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data = pd.read_excel('ourx.xlsx')\n",
"data.head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"A. For a order quantity of 500,000 doses, what is the net profit when demand is 400,000 doses and 600,000 doses, respectively?"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Profit = $ 2000000\n"
]
}
],
"source": [
"# net profit when demand is 400,000 doses\n",
"demand = 400000\n",
"orders = 500000\n",
"price = 20\n",
"unit_cost = 12\n",
"\n",
"if demand >= orders:\n",
" net_profit = orders*(price-unit_cost)\n",
"else:\n",
" net_profit = (demand*price)-(orders*unit_cost)\n",
" \n",
"print('Profit = $',net_profit)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Profit = $ 4000000\n"
]
}
],
"source": [
"# net profit when demand is 600,000 doses\n",
"demand = 600000\n",
"orders = 500000\n",
"price = 20\n",
"unit_cost = 12\n",
"\n",
"if demand >= orders:\n",
" net_profit = orders*(price-unit_cost)\n",
"else:\n",
" net_profit = (demand*price)-(orders*unit_cost)\n",
" \n",
"print('Profit = $',net_profit)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"B. Plot a histogram of the demand data. What distribution seems appropriate for modelling demand?"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(array([475., 12., 7., 3., 1., 1., 0., 0., 0., 1.]),\n",
" array([3.15700000e+03, 3.73965890e+06, 7.47616080e+06, 1.12126627e+07,\n",
" 1.49491646e+07, 1.86856665e+07, 2.24221684e+07, 2.61586703e+07,\n",
" 2.98951722e+07, 3.36316741e+07, 3.73681760e+07]),\n",
" )"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png":...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here