Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.58 KB | None | 0 0
  1. #Highway robbery is a great way to sum up insurance.
  2. age=0
  3. traffic_violations=0
  4. risk_code = 0
  5. risk_type = "None"
  6. insurance_price=0
  7. def main():
  8.     #Gathering info from the use
  9.     name = input("Enter your name: ")
  10.     age = int(input("Enter enter you age: "))
  11.     while age <16:
  12.         print('Invalid Entry!')
  13.         age = int(input("Enter enter you age: "))
  14.     traffic_violations = int(input("Enter the number of traffic violations: "))
  15.     figure_risk(traffic_violations)
  16.     figure_insurance(age, traffic_violations,risk_code)
  17.     print('risk_type=%s' % risk_type)
  18.     show_info(name,figure_risk,figure_insurance)
  19.                              
  20. #Determing the risk type
  21. def figure_risk(traffic_violations):
  22.     print("dertermine risk")
  23.     if traffic_violations >=4:
  24.         risk_code = 1
  25.         risk_type = "High"
  26.     elif traffic_violations == 3:
  27.         risk_code = 2
  28.         risk_type = "Moderate"
  29.     elif traffic_violations == 2:
  30.         risk_code = 3
  31.         risk_type = "Moderate"
  32.     elif traffic_violations == 1:
  33.         risk_code = 3
  34.         risk_type = "Low"
  35.     elif traffic_violations == 0:
  36.         risk_code = 4
  37.         risk_type = "None"
  38.         return risk_code, risk_type
  39.                              
  40.                            
  41. #figuring the price
  42. def figure_insurance(age, traffic_violations, risk_code):
  43.     print("figuring the math")
  44.     if age <= 24 and traffic_violations >= 4 and risk_code == 1:
  45.         insurance_price = 480
  46.     elif age >= 25 and traffic_violations >= 4 and risk_code == 1:
  47.         insurance_price = 410
  48.     elif age <= 24 and traffic_violations == 3 and risk_code == 2:
  49.         insurance_price4 = 450
  50.     elif age >= 25 and traffic_violations == 3 and risk_code == 2:
  51.         insurance_price = 390
  52.     elif age <= 24 and traffic_violations == 2 and risk_code == 2:
  53.         insurance_price = 405
  54.     elif age >= 25 and traffic_violations == 2 and risk_code == 2:
  55.         insuransce_price = 365
  56.     elif age <= 24 and traffic_violations == 1 and risk_code == 3:
  57.         insurance_price = 380
  58.     elif age >= 25 and traffic_violations == 1 and risk_code == 3:
  59.         insurance_price = 315
  60.     elif age <= 24 and traffic_violations == 0 and risk_code == 4:
  61.         insurance_price = 325
  62.     elif age >= 25 and traffic_violations == 0 and risk_code == 4:
  63.         insurance_price = 275
  64.         return insurance_price
  65. #Presenting the information to the user
  66. def show_info(name,figure_risk,figure_insurance):
  67.         print(name,",as a",risk_type,"risk driver, your insurance will be $",(insurance_price))
  68. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement