human
Check if a large number is divisibility by 15 | to find sum.
function to check if a large number is divisible by 15.
length of string.
check divisibility by 5.
Sum of digits.
if divisible by 3.
Driver Code"
How can the above be solved in Python?
 What is a code to check if a large number is divisibility by 15 and the other steps required?
assistant
#Here is code to check if a large number is divisibility by 15 and the other steps required.
 def accumulate ( s ) :
	acc = 0 ;
	for i in range ( len ( s ) ) :
		acc += ord ( s [ i ] ) - 48 ;
	return acc ;
def isDivisible ( s ) :
	n = len ( s ) ;
	if ( s [ n - 1 ] != '5' and s [ n - 1 ] != '0' ) :
		return False ;
	sum = accumulate ( s ) ;
	return ( sum % 3 == 0 ) ;
s = "15645746327462384723984023940239" ;
if isDivisible ( s ) :
	print ( " Yes " ) ;
else :
	print ( " No " ) ;
s = "15645746327462384723984023940235" ;
if isDivisible ( s ) :
	print ( " Yes " ) ;
else :
	print ( " No " ) ;