human
Probability that the sum of all numbers obtained on throwing a dice N times lies between two given integers | Function to calculate the probability for the given sum to be equal to sum in N throws of dice.
Base cases.
Driver Code.
Print the answer"
Solution in Python:
 ... Can you provide a code to probability that the sum of all numbers obtained on throwing a dice N times lies between two given integers and the other steps required?
assistant
#Here is code to probability that the sum of all numbers obtained on throwing a dice N times lies between two given integers and the other steps required.
 def find ( N , sum ) :
	if ( sum > 6 * N or sum < N ) :
		return 0
	if ( N == 1 ) :
		if ( sum >= 1 and sum <= 6 ) :
			return 1.0 / 6
		else :
			return 0
	s = 0
	for i in range ( 1 , 7 ) :
		s = s + find ( N - 1 , sum - i ) / 6
	return s
if __name__ == " _ _ main _ _ " :
	N = 4
	a = 13
	b = 17
	probability = 0.0
	for sum in range ( a , b + 1 ) :
		probability = probability + find ( N , sum )
	print ( round ( probability , 6 ) )