kaprekarNumbers 🙀

Run Settings
LanguagePython
Language Version
Run Command
def kaprekarNumbers(p, q): # Write your code here res = [] for i in range(p,q+1): temp = str(i*i) for j in range(len(temp)-1): if (int(temp[:j+1])+int(temp[j+1:]) == i) and (int(temp[:j+1]) != 0 and int(temp[j+1:]) != 0): res.append(i) print(temp[:j+1],temp[j+1:],"num:",i) # print(temp) kaprekarNumbers(1000,10000)
Editor Settings
Theme
Key bindings
Full width
Lines