human
Repunit numbers | Function to check if a number contains all the digits 0 , 1 , . . , ( b - 1 ) an equal number of times.
to store number of digits of n in base B.
to count frequency of digit 1.
condition to check three or more 1 's  and number of ones is equal to number  of digits of n in base B.
Driver Code.
taking inputs.
function to check"
How can the above be solved in Python?

=====
What is a code to repunit numbers and the other steps required?
assistant
#Here is code to repunit numbers and the other steps required.
 def isRepunitNum ( n , b ) :
	length = 0 ;
	countOne = 0 ;
	while ( n != 0 ) :
		r = n % b ;
		length += 1 ;
		if ( r == 1 ) :
			countOne += 1 ;
		n = n // b ;
	return countOne >= 3 and countOne == length ;
if __name__ == ' _ _ main _ _ ' :
	n = 31 ;
	base = 2 ;
	if ( isRepunitNum ( n , base ) ) :
		print ( " Yes " ) ;
	else :
		print ( " No " ) ;