human
What is a code to check if the given number is divisible by 71 or not and the other steps required given the following:
Check if the given number is divisible by 71 or not | Function to check if the number is divisible by 71 or not.
While there are at least two digits.
Extracting the last.
Truncating the number.
Subtracting seven times the last digit to the remaining number.
Finally return if the two - digit number is divisible by 71 or not.
Driver Code"
How can the above be solved in Python?
assistant
#Here is code to check if the given number is divisible by 71 or not and the other steps required.
 def isDivisible ( n ) :
	while n // 100 :
		d = n % 10
		n //= 10
		n = abs ( n - ( d * 7 ) )
	return ( n % 71 == 0 )
if __name__ == " _ _ main _ _ " :
	N = 5041
	if ( isDivisible ( N ) ) :
		print ( " Yes " )
	else :
		print ( " No " )