I have to write a program that gets multiple strings one after the other that is terminated by the sentinel DONE, and then print this list of strings right justified to the length of the biggest string. Here is my code:
user = input("Enter strings (end with DONE):\n")
totalString = ""
while True:
if user.lower() == 'done':
break
else:
totalString = totalString + user + " "
user = input("")
lst = totalString.split(" ")
max = 0
for i in range(len(lst)):
if len(lst[i]) > max:
max = len(lst[i])
for i in range(len(lst)):
print("{:>{derp}}".format(lst[i],derp=max))
The issue I'm having is that the if statement in the while loop never executes, so it just gets stuck in that loop.