human
Count number of ways to cover a distance | Function returns count of ways to cover ' dist '.
Initialize base values . There is one way to cover 0 and 1 distances and two ways to cover 2 distance.
Fill the count array in bottom up manner.
driver program"
How can the above be solved in Python?
 ... Give me a code to count number of ways to cover a distance and the other steps required?
assistant
#Here is code to count number of ways to cover a distance and the other steps required.
 def printCountDP ( dist ) :
	count = [ 0 ] * ( dist + 1 )
	count [ 0 ] = 1
	if dist >= 1 :
		count [ 1 ] = 1
	if dist >= 2 :
		count [ 2 ] = 2
	for i in range ( 3 , dist + 1 ) :
		count [ i ] = ( count [ i - 1 ] + count [ i - 2 ] + count [ i - 3 ] )
	return count [ dist ] ;
dist = 4 ;
print ( printCountDP ( dist ) )