human
Number of times a number can be replaced by the sum of its digits until it only contains one digit | Python 3 program to count number of times we need to add digits to get a single digit ..
Here the count variable store how many times we do sum of digits and temporary_sum always store the temporary sum we get at each iteration ..
In this loop we always compute the sum of digits in temporary_ sum variable and convert it into string str till its length become 1 and increase the count in each iteration ..
computing sum of its digits.
converting temporary_sum into string str again ..
increase the count.
Driver Code"
Solution in Python:

Give me a code to number of times a number can be replaced by the sum of its digits until it only contains one digit and the other steps required?
assistant
#Here is code to number of times a number can be replaced by the sum of its digits until it only contains one digit and the other steps required.
 def NumberofTimes ( s ) :
	temporary_sum = 0
	count = 0
	while ( len ( s ) > 1 ) :
		temporary_sum = 0
		for i in range ( len ( s ) ) :
			temporary_sum += ( ord ( s [ i ] ) - ord ( '0' ) )
		s = str ( temporary_sum )
		count += 1
	return count
if __name__ == " _ _ main _ _ " :
	s = "991"
	print ( NumberofTimes ( s ) )