human
Program to calculate Electricity Bill | Function to calculate the electricity bill.
Condition to find the charges bar in which the units consumed is fall.
Driver Code"
How can the above be solved in Python?
assistant
#Here is code to program to calculate Electricity Bill and the other steps required.
 def calculateBill ( units ) :
	if ( units <= 100 ) :
		return units * 10 ;
	elif ( units <= 200 ) :
		return ( ( 100 * 10 ) + ( units - 100 ) * 15 ) ;
	elif ( units <= 300 ) :
		return ( ( 100 * 10 ) + ( 100 * 15 ) + ( units - 200 ) * 20 ) ;
	elif ( units > 300 ) :
		return ( ( 100 * 10 ) + ( 100 * 15 ) + ( 100 * 20 ) + ( units - 300 ) * 25 ) ;
	return 0 ;
units = 250 ;
print ( calculateBill ( units ) ) ;