pacho_the_python

Untitled

Oct 22nd, 2021
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.73 KB | None | 0 0
  1. months = int(input())
  2.  
  3. water = 20
  4. internet = 15
  5. electricity_bill = 0
  6. other_bill = 0
  7. total_bill = 0
  8. for month in range(1, months + 1):
  9.     current_electricity = float(input())
  10.     electricity_bill += current_electricity
  11.     current_costs = current_electricity + water + internet
  12.     other_costs = current_costs + current_costs * 0.2
  13.     other_bill += other_costs
  14.     total = current_costs + other_costs
  15.     total_bill += total
  16.  
  17.  
  18. water_bill = water * months
  19. internet_bill = months * internet
  20. average = total_bill / months
  21.  
  22.  
  23. print(f"Electricity: {electricity_bill:.2f} lv")
  24. print(f"Water: {water_bill:.2f} lv")
  25. print(f"Internet: {internet_bill:.2f} lv")
  26. print(f"Other: {other_bill:.2f} lv")
  27. print(f"Average: {average:.2f} lv")
Advertisement
Add Comment
Please, Sign In to add comment