human
Total no of 1 's in numbers | Python3 code to count the frequency of 1 in numbers less than or equal to the given number ..
Driver Code"
Solution in Python:
 ... Write me a code to total no of 1 's in numbers and the other steps required?
assistant
#Here is code to total no of 1 's in numbers and the other steps required.
 def countDigitOne ( n ) :
	countr = 0 ;
	for i in range ( 1 , n + 1 ) :
		str1 = str ( i ) ;
		countr += str1 . count ( "1" ) ;
	return countr ;
n = 13 ;
print ( countDigitOne ( n ) ) ;
n = 131 ;
print ( countDigitOne ( n ) ) ;
n = 159 ;
print ( countDigitOne ( n ) ) ;