Advertisement
GalinaKG

02.Tax Calculator

Jun 26th, 2022
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.22 KB | None | 0 0
  1. string_with_vehicles = input().split('>>')
  2. initial_tax = 0
  3. total_sum_tax = 0
  4. total_taxes_collected = 0
  5.  
  6. for vehicles in string_with_vehicles:
  7.     vehicles_number = vehicles.split()
  8.     years_tax_should_paid = int(vehicles_number[1])
  9.     kilometers = int(vehicles_number[2])
  10.  
  11.     if vehicles_number[0] == 'family':
  12.         initial_tax = 50
  13.         how_many_times_increase = kilometers // 3000
  14.         total_sum_tax = initial_tax + (how_many_times_increase * 12) - (years_tax_should_paid * 5)
  15.  
  16.     elif vehicles_number[0] == 'heavyDuty':
  17.         initial_tax = 80
  18.         how_many_times_increase = kilometers // 9000
  19.         total_sum_tax = initial_tax + (how_many_times_increase * 14) - (years_tax_should_paid * 8)
  20.     elif vehicles_number[0] == 'sports':
  21.         initial_tax = 100
  22.         how_many_times_increase = kilometers // 2000
  23.         total_sum_tax = initial_tax + (how_many_times_increase * 18) - (years_tax_should_paid * 9)
  24.     else:
  25.         print("Invalid car type.")
  26.         continue
  27.  
  28.     total_taxes_collected += total_sum_tax
  29.  
  30.     print(f"A {vehicles_number[0]} car will pay {total_sum_tax:.2f} euros in taxes.")
  31.  
  32. print(f"The National Revenue Agency will collect {total_taxes_collected:.2f} euros in taxes.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement