title: How to use for and while loop to sort in alphabetical order using python?
body: <p>I'm still trying to learn on python.
  I've created a list of fruit as follow</p>
  
  <pre><code>fruitList = ["pear","apple","strawberry","banana","orange"]
  </code></pre>
  
  <p>I would like to print them out in alphabetical order using for loop and while loop.</p>
  
  <pre><code>   fruitList.sort()
  </code></pre>
  
  <p>because python have this function called sort() thus, I'm able to sort.
  But what if I do not want to use the sort function?</p>
  
  <p>However, right now, I've issue on how to sort using while loop?
  can someone tell me how am I able to do so?
  This is what I've tried, using len()</p>
  
  <pre><code>for fruit in fruitList:
      while (len(fruitList[0]) &gt; len(fruit[0])):
              fruit += 1
              print fruit
              continue
  </code></pre>
  
  <p>Nothing is printed when I run this program.
  In a while loop, am I suppose to compare with the index[0] or can I use sort function as well?</p>