#35 Built in array methods

Hey, i’m struggling with the answer to this question. I pretty much did it myself then looked to the answer sheet and added the extra bits i was missing. However, even with the answer i’m struggling to get it to sort the alphabet. Instead it gives the below;

Screen Shot 2020-12-11 at 3.28.08 PM

1 Like

Hi @jakegoode95,

Well, this is happening because some of your array elements have space in the string. Since space take more precedence over the letter, that variable is printed out. Now, in your list, the string with k is " K " and not "K". If you remove the spaces and then try sorting, you will resolve the issue.

Hope this helps. :smile:

1 Like

Thanks Malik!

Didn’t notice that at all, thanks for showing me! :slight_smile:

1 Like