DEV Community

yaswanth krishna
yaswanth krishna

Posted on

python using Eb bill basic

units = int(input("Enter the total number of units: "))  

if units <= 100:
    bill = 0  
elif units <= 200:
    bill = (units - 100) * 2  
elif units <= 500:
    bill = (100 * 2) + (units - 200) * 5  
else:
    bill = (100 * 2) + (300 * 5) + (units - 500) * 8  

print(" Electricity Bill Amount: {bill})  

Enter fullscreen mode Exit fullscreen mode

output:
Enter the total number of units: 5000
Electricity Bill Amount: ₹37700

Top comments (1)

Collapse
 
brodericks11010 profile image
Broderickson Steven

Using Python for EB bill basics allows users to efficiently calculate and manage electricity consumption. By leveraging simple logic and formulas, one can determine the total cost based on units consumed, tariff rates, and applicable taxes. Just like checking an electricity bill online, Python can automate bill calculations, making the process faster and more accurate. Whether for personal tracking or business use, Python provides a reliable way to handle energy expenses.

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay