human
Squares of numbers with repeated single digits | Set 1 ( 3 , 6 and 9 ) | Function to find the square of 333. . .333 , 666. . .666 and 999. . .999.
if the number is 333. . .333.
if the number is 666. . .666.
if the number is 999. . .999.
variable for hold result.
find the no of digit.
add size - 1 time a in result.
add one time b in result.
add size - 1 time c in result.
add one time d in result.
return result.
Drivers code Your Python 3 Code.
find square of 33. .33.
find square of 66. .66.
find square of 66. .66"
Solution in Python:
 What is a code to squares of numbers with repeated single digits and the other steps required?
assistant
#Here is code to squares of numbers with repeated single digits and the other steps required.
 def find_Square_369 ( num ) :
	if ( num [ 0 ] == '3' ) :
		a = '1'
		b = '0'
		c = '8'
		d = '9'
	elif ( num [ 0 ] == '6' ) :
		a = '4'
		b = '3'
		c = '5'
		d = '6'
	else :
		a = '9'
		b = '8'
		c = '0'
		d = '1'
	result = " "
	size = len ( num )
	for i in range ( 1 , size ) :
		result += a
	result += b
	for i in range ( 1 , size ) :
		result += c
	result += d
	return result
num_3 = "3333"
num_6 = "6666"
num_9 = "9999"
result = " "
result = find_Square_369 ( num_3 )
print ( " Square ▁ of ▁ " + num_3 + " ▁ is ▁ : ▁ " + result ) ;
result = find_Square_369 ( num_6 )
print ( " Square ▁ of ▁ " + num_6 + " ▁ is ▁ : ▁ " + result ) ;
result = find_Square_369 ( num_9 )
print ( " Square ▁ of ▁ " + num_9 + " ▁ is ▁ : ▁ " + result ) ;