human
Distributed C candies among N boys such that difference between maximum and minimum candies received is K | Function to calculate the maximum and minimum number of candies a boy can possess.
All candies will be given to one boy.
All the candies will be given to 1 boy.
Give K candies to 1 st boy initially.
Count remaining candies.
If the last candy of remaining candies is given to the last boy , i . e Nth boy.
Increase minimum count.
Driver code"
How can the above be solved in Python?
 Write me a code to distributed C candies among N boys such that difference between maximum and minimum candies received is K and the other steps required?
assistant
#Here is code to distributed C candies among N boys such that difference between maximum and minimum candies received is K and the other steps required.
 def max_min ( N , C , K ) :
	maximum = 0
	minimum = 0
	if ( N == 1 ) :
		maximum = minimum = C
	elif ( K >= C ) :
		maximum = C
		minimum = 0
	else :
		maximum = K
		minimum = 0
		remain_candy = C - K
		maximum += remain_candy // N
		minimum = remain_candy // N
	if ( remain_candy % N == N - 1 ) :
		minimum += 1
	print ( " Maximum ▁ = ▁ { } " . format ( maximum ) )
	print ( " Minimum ▁ = ▁ { } " . format ( minimum ) )
N = 4
C = 12
K = 3
max_min ( N , C , K )