Question: Using python create a code to answer the question: You own an insurance company. Your insurance company covers homes in the zip codes:[11111,11112,11113,11114,11115,11116,11117,11118,11119] Each home
Using python create a code to answer the question:
You own an insurance company. Your insurance company covers homes in the zip codes:[11111,11112,11113,11114,11115,11116,11117,11118,11119]
Each home is rated 1 - 5 for hurricane damage resistance (1 being the lowest and 5 being the highest).
The homes covered are in the range $250,000 - $1,000,000 rounded to $100 increments.
A hurricane is approaching and you need to calculate your best and worst case vulnerability re: losses.
In this program you are to ask the user the enter the zip codes of the at risk areas (use a while loop - as long as the user wants to enter another zip code allow them to do so) and the rating of the hurricane (1 - 5, trap the user to reenter a value if an invalid value is entered).
Calculate and print to the screen the values for:
Best case: 10% lose of value of vulnerable homes
Worst case: 90% lose of value of vulnerable homes
The code to generate the homes you cover is below:
import random
##develop file
building_rating = [1,2,3,4,5]
zip_codes = [11111,11112,11113,11114,11115,11116,11117,11118,11119]
temp = []
house_values = []
for i in range(250_000, 1_000_000, 100):
house_values.append(i)
covered_homes = []
for i in range(100):
temp = []
temp.append(random.choice(building_rating))
temp.append(random.choice(zip_codes))
temp.append(random.choice(house_values))
covered_homes.append(temp)
print(covered_homes)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
