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 (0)