Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created December 14, 2020 18:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save codecademydev/714a8b9d0c69f6ae61bdd3c2b71a40c4 to your computer and use it in GitHub Desktop.
Save codecademydev/714a8b9d0c69f6ae61bdd3c2b71a40c4 to your computer and use it in GitHub Desktop.
Codecademy export
# Function to estimate insurance cost:
def estimate_insurance_cost(name, age, sex, bmi, num_of_children, smoker):
estimated_cost = 250*age - 128*sex + 370*bmi + 425*num_of_children + 24000*smoker - 12500
print(name + "'s Estimated Insurance Cost: " + str(estimated_cost) + " dollars.")
return estimated_cost
names = ['Maria', 'Rohan', 'Valentina']
insurance_costs = [4150, 5320, 35210]
insurance_data = list(zip(names, insurance_costs))
print(insurance_data)
list(zip(insurance_data))
estimated_insurance_data = []
estimated_insurance_data.append(("Maria", maria_insurance_cost))
estimated_insurance_data.append(("Rohan", rohan_insurance_cost))
estimated_insurance_data.append(("Valentina", valentina_insurance_cost))
print(estimated_insurance_data)
# Estimate Maria's insurance cost
maria_insurance_cost = estimate_insurance_cost(name = "Maria", age = 31, sex = 0, bmi = 23.1, num_of_children = 1, smoker = 0)
# Estimate Rohan's insurance cost
rohan_insurance_cost = estimate_insurance_cost(name =
"Rohan", age = 25, sex = 1, bmi = 28.5, num_of_children = 3, smoker = 0)
# Estimate Valentina's insurance cost
valentina_insurance_cost = estimate_insurance_cost(name = "Valentina", age = 53, sex = 0, bmi = 31.4, num_of_children = 0, smoker = 1)
# Add your code here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment