So I'm writing a code that alphabetizes three words, but I'm trying to be cool, and actually alphabetize it (if both words start with h, it will go to the second letter). I'm basically a beginner, so nothing advanced I'm just using while loops. I got the code to work once, but then it stopped working. Out teacher in the direction said the function we write can't have a return, so here is my code.
def printInOrder(str1, str2, str3):
i = 0
i = int(i)
list_1 = [str1, str2, str3]
while i < len(str1) < len(str2) < len(str3):
if list_1[0][i] = list_1[1][i] = list_1[2][i]:
i += 1
elif list_1[0][i] < list_1[1][i] < list_1[2][i]:
first = list_1[0]
second = list_1[1]
third = list_1[2]
elif list_1[0][i] < list_1[2][i] < list_1[1][i]:
first = list_1[0]
second = list_1[2]
third = list_1[1]
elif list_1[1][i] < list_1[0][i] < list_1[2][i]:
first = list_1[1]
second = list_1[0]
third = list_1[2]
elif list_1[1][i] < list_1[2][i] < list_1[0][i]:
first = list_1[1]
second = list_1[2]
third = list_1[0]
elif list_1[2][i] < list_1[0][i] < list_1[1][i]:
first = list_1[2]
second = list_1[0]
third = list_1[1]
else:
first = list_1[2]
second = list_1[1]
third = list_1[0]
first = str(first)
second = str(second)
third = str(third)
print(first,second,third)