def sq(num): words = list(str(num)) # split the text for word in words: # for each word in the line: print(int(word)**2, end="") # print the word num = 9119 sq(num)