human
Length of the smallest number which is divisible by K and formed by using 1 's only | Function to return length of the resultant number.
If K is a multiple of 2 or 5.
Instead of generating all possible numbers 1 , 11 , 111 , 111 , ... , K 1 's  Take remainder with K.
If number is divisible by k then remainder will be 0.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to length of the smallest number which is divisible by K and formed by using 1 's only and the other steps required.
 def numLen ( K ) :
	if ( K % 2 == 0 or K % 5 == 0 ) :
		return - 1
	number = 0
	len = 1
	for len in range ( 1 , K + 1 ) :
		number = ( number * 10 + 1 ) % K
		if number == 0 :
			return len
	return - 1
K = 7
print ( numLen ( K ) )