Energy Bill Calculator with Python

preview_player
Показать описание
Use this simple python script to calculate potential monthly energy costs using the information provided in EFL documents from various energy companies.

CODE:
def average_kwh_cost(kwh_charges, usage, base_charges):
total_cost = usage * sum(kwh_charges) + sum(base_charges)
return (total_cost / usage) * 100

kwh_charges = [float(x) for x in input("Enter kWh charges separated by space: ").split()]
usage = int(input("Enter monthly usage (kWh): "))
base_charges = [float(x) for x in input("Enter base charges separated by space: ").split()]

average_cost = average_kwh_cost(kwh_charges, usage, base_charges)
print("The average cost per kWh is: {:.2f} cents".format(average_cost))
Рекомендации по теме
Комментарии
Автор

thx for ur efforts . i would love if u edit it and be consistent ;) U got a sub !

tanmaydhanawat
Автор

When I moved to Texas the first apartment complex had their own provider that they were contracted with and the rates were super cheap, but when I moved I had to find my own provider and that was a headache and my energy bills went up significantly. lol I got into a contract with Gexa at 11 cents at 1000kwh monthly, but after calculating fees that gets it up to roughly 14 cents or so. and if you are under the 1000 kwh its 17 cents plus the fees which gets it up to nearly 20 cents. Absolutely insane.

stringbreaker