Advertisement
GeorgiLukanov87

tax_agency_exam_2022

Jun 26th, 2022
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.92 KB | None | 0 0
  1. data = input().split(">>")
  2. agency_income = []
  3.  
  4. for vehicle in data:
  5.     invalid_car = False
  6.     details = vehicle.split(' ')
  7.     type_car = details[0]
  8.     year_car = int(details[1])
  9.     kms_car = int(details[2])
  10.     total_tax = 0
  11.  
  12.     if type_car == 'family':
  13.         total_tax += 50
  14.         total_tax -= 5 * year_car
  15.         total_tax += (kms_car // 3000) * 12
  16.     elif type_car == 'heavyDuty':
  17.         total_tax += 80
  18.         total_tax -= 8 * year_car
  19.         total_tax += (kms_car // 9000) * 14
  20.     elif type_car == 'sports':
  21.         total_tax += 100
  22.         total_tax -= 9 * year_car
  23.         total_tax += (kms_car // 2000) * 18
  24.     else:
  25.         print('Invalid car type.')
  26.         invalid_car = True
  27.     agency_income.append(total_tax)
  28.  
  29.     if not invalid_car:
  30.         print(f'A {type_car} car will pay {total_tax:.2f} euros in taxes.')
  31. print(f'Agency will collect {sum(agency_income):.2f} euros in taxes')
  32.  
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement