Question: I'm still trying to learn on python.
I've created a list of fruit as follow

```
fruitList = ["pear","apple","strawberry","banana","orange"]

```

I would like to print them out in alphabetical order using for loop and while loop.

```
   fruitList.sort()

```

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?

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()

```
for fruit in fruitList:
    while (len(fruitList[0]) > len(fruit[0])):
            fruit += 1
            print fruit
            continue

```

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?

Answer: 
you can do so:

```
for f in sorted(fruitList):
    print(f)

```

and with while:

```
while fruitList:
    print(min(fruitList))
    fruitList.remove(min(fruitList))

```

But I mean, using "while" is a bad idea

P.S. sort() is not a function, It is a list method
OK, first of all you're trying to sort according to alphabetical, then why are you considering the length of the word on your list instead of their name?

Also, there are some mistakes in your code and I don't understand what you're trying to do.

```
for fruit in fruitList:
    while (len(fruitList[0]) > len(fruit[0])):
        fruit += 1
        print fruit
        continue

```

First, `len(fruitList[0])` is the length of the first item in your list (let's say it's `pear`). 

In the first iteration, `fruit` will be `fruitList[0]`, `pear`.

When you're doing `len(fruitList[0]) > len(fruit[0])` you're doing (in the first iteration) `len("pear") > len('p')` which is always 'True' as long as you don't have an empty string ... in which case `fruit[0]` would throw an error.
Now, why are you doing this? What are you trying to do?

Anyway, let's move on, since the above condition was 'True', then the next line of code is `fruit +=1` but `fruit` is a string and '1' is an int, so you're trying to add a 'str' + 'int' which raises an error.

Sooooo.... your code doesn't run, it throws an error, if you're saying that your code doesn't print anything, then you're getting 'False' in your while chunk, so the code you posted isn't the exact same thing you're running in your computer, am I right?

Finnally, to answer your question, to order your list in alphabetical order, you have to check for the letters.

First set the first item in the list as the first item.
Then check the second item in your list and compare with the item before, if the second goes before, then move it.
Then check the next item, compare with the item before it, if it goes before, then compare with the item before that one and move accordingly... repeat until you've check everyitem in the list. ---> Or use Bubble sort as explained above (just read that answer)