human
Check if the large number formed is divisible by 41 or not | Check if a number is divisible by 41 or not.
array to store all the digits.
base values.
calculate remaining digits.
calculate answer.
check for divisibility.
Driver Code"
How can the above be solved in Python?
 Write me a code to check if the large number formed is divisible by 41 or not and the other steps required?
assistant
#Here is code to check if the large number formed is divisible by 41 or not and the other steps required.
 def DivisibleBy41 ( first , second , c , n ) :
	digit = [ 0 ] * n
	digit [ 0 ] = first
	digit [ 1 ] = second
	for i in range ( 2 , n ) :
		digit [ i ] = ( digit [ i - 1 ] * c + digit [ i - 2 ] ) % 10
	ans = digit [ 0 ]
	for i in range ( 1 , n ) :
		ans = ( ans * 10 + digit [ i ] ) % 41
	if ( ans % 41 == 0 ) :
		return True
	else :
		return False
first = 1
second = 2
c = 1
n = 3
if ( DivisibleBy41 ( first , second , c , n ) ) :
	print ( " YES " )
else :
	print ( " NO " )