I want to get rid of the white space at the end of each line.
w = input("Words: ")
w = w.split()
k = 1
length = []
for ws in w:
length.append(len(ws))
y = sorted(length)
while k <= y[-1]:
if k in length:
for ws in w:
if len(ws) != k:
continue
else:
print(ws, end=" ")
print("")
k += 1
The out put is giving me lines of words in assessing lengths eg if I type in I do love QI; I do QI love
But it has white space at the end of each line. If I try to .rstrip() it I also delete the spaces between the words and get; I doQI love