233k views
0 votes
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)

User Cesarbs
by
7.1k points

1 Answer

6 votes

Final answer:

To create a code to calculate the best and worst case vulnerability for an insurance company, you can use Python. First, ask the user to enter the zip codes of the at-risk areas and the rating of the hurricane. Then, calculate the best and worst case vulnerability by deducting percentages from the value of vulnerable homes. Finally, print the values for the best and worst case vulnerability.

Step-by-step explanation:

To create a code to calculate the best and worst case vulnerability for an insurance company, you can use Python. First, you need to ask the user to enter the zip codes of the at-risk areas and the rating of the hurricane. Use a while loop to allow the user to enter multiple zip codes. Trap the user to reenter a value if an invalid rating is entered. Next, calculate the best case vulnerability by deducting 10% from the value of vulnerable homes and the worst case vulnerability by deducting 90% from the value of vulnerable homes. Finally, print the values for the best and worst case vulnerability to the screen.

User Alisonthemonster
by
8.2k points