human
What is a code to maximum litres of water that can be bought with N Rupees and the other steps required given the following:
Maximum litres of water that can be bought with N Rupees | Python3 implementation of the above approach.
if buying glass bottles is profitable.
Glass bottles that can be bought.
Change budget according the bought bottles.
Plastic bottles that can be bought.
if only plastic bottles need to be bought.
Driver Code"
How can the above be solved in Python?
assistant
#Here is code to maximum litres of water that can be bought with N Rupees and the other steps required.
 def maxLitres ( budget , plastic , glass , refund ) :
	if glass - refund < plastic :
		ans = max ( ( budget - refund ) // ( glass - refund ) , 0 )
		budget -= ans * ( glass - refund )
		ans += budget // plastic
		print ( ans )
	else :
		print ( budget // plastic )
budget , plastic , glass , refund = 10 , 11 , 9 , 8
maxLitres ( budget , plastic , glass , refund )