list=['the','i','am','light','life'] a=sorting(list) def sorting(x): for i in range(0,4): if len(x[i]) < len(x[i+1]): pass else: temp=x[i+1] x[i+1]=x[i] x[i]=temp print(a)The home work is to sort those words by the length of the word.
the coding must use the bottom part codes
list=['the','i','am','light','life'] a=sorting(list) print(a)my home work is to make the coding for def sorting
any help plz? whats wrong and why is this happening?