You are viewing a single comment's thread. Return to all comments →
mycodeinpython :)
def kaprekarNumbers(p, q): # Write your code here kaprekar = [] for i in range(p,q+1): b_str = str(i**2) if(int(b_str)<=9): if(int(b_str)==1): kaprekar.append(i) elif(int(b_str[0:(len(b_str)//2)])+int(b_str[len(b_str)//2:len(b_str)])==i): kaprekar.append(i) if (len(kaprekar)==0): print("INVALID RANGE") else: for i in kaprekar: print(i,end=' ')
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 →
mycodeinpython :)