You are viewing a single comment's thread. Return to all comments →
def kaprekarNumbers(p, q): # Write your code here exists = False for n in range(p, q+1): d = len(str(n)) n_quare = str(n * n) left, right = n_quare[:-d], n_quare[-d:] if int(left or 0) + int(right) == n: print(n, end=" ") exists = True if not exists: print("INVALID RANGE")
Seems like cookies are disabled on this browser, please enable them to open this website
Modified Kaprekar Numbers
You are viewing a single comment's thread. Return to all comments →