Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Highway robbery is a great way to sum up insurance.
- age=0
- traffic_violations=0
- risk_code = 0
- risk_type = "None"
- insurance_price=0
- def main():
- #Gathering info from the use
- name = input("Enter your name: ")
- age = int(input("Enter enter you age: "))
- while age <16:
- print('Invalid Entry!')
- age = int(input("Enter enter you age: "))
- traffic_violations = int(input("Enter the number of traffic violations: "))
- figure_risk(traffic_violations)
- figure_insurance(age, traffic_violations,risk_code)
- print('risk_type=%s' % risk_type)
- show_info(name,figure_risk,figure_insurance)
- #Determing the risk type
- def figure_risk(traffic_violations):
- print("dertermine risk")
- if traffic_violations >=4:
- risk_code = 1
- risk_type = "High"
- elif traffic_violations == 3:
- risk_code = 2
- risk_type = "Moderate"
- elif traffic_violations == 2:
- risk_code = 3
- risk_type = "Moderate"
- elif traffic_violations == 1:
- risk_code = 3
- risk_type = "Low"
- elif traffic_violations == 0:
- risk_code = 4
- risk_type = "None"
- return risk_code, risk_type
- #figuring the price
- def figure_insurance(age, traffic_violations, risk_code):
- print("figuring the math")
- if age <= 24 and traffic_violations >= 4 and risk_code == 1:
- insurance_price = 480
- elif age >= 25 and traffic_violations >= 4 and risk_code == 1:
- insurance_price = 410
- elif age <= 24 and traffic_violations == 3 and risk_code == 2:
- insurance_price4 = 450
- elif age >= 25 and traffic_violations == 3 and risk_code == 2:
- insurance_price = 390
- elif age <= 24 and traffic_violations == 2 and risk_code == 2:
- insurance_price = 405
- elif age >= 25 and traffic_violations == 2 and risk_code == 2:
- insuransce_price = 365
- elif age <= 24 and traffic_violations == 1 and risk_code == 3:
- insurance_price = 380
- elif age >= 25 and traffic_violations == 1 and risk_code == 3:
- insurance_price = 315
- elif age <= 24 and traffic_violations == 0 and risk_code == 4:
- insurance_price = 325
- elif age >= 25 and traffic_violations == 0 and risk_code == 4:
- insurance_price = 275
- return insurance_price
- #Presenting the information to the user
- def show_info(name,figure_risk,figure_insurance):
- print(name,",as a",risk_type,"risk driver, your insurance will be $",(insurance_price))
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement