Hey guys I'm new here and I'm practically brand new to programming. I knew how to do a (very small) handful of things in actionscript like 7-8 years ago but I'm just now finally getting back into programming. After browsing theses forums and others I decided that Python was the best for me to start with. Since this was the most helpful forum in that decision, I ended up signing yesterday. And today I finally have a problem that I could use some help with.
I'm following the inventwithpython.com book and got stuck on chapter 11:
A bit past halfway in the "The sort() list method" section it says to try typing the following into the shell:
>>> spam = [5, 'bat', 3, 1, 4, 'cat', 2, 'ape']
[1, 2, 3, 4, 5, 'ape', 'bat', 'cat']
I fully understand what the sort() method does, but it is giving me this error:
Traceback (most recent call last):
File "<pyshell#35>", line 1, in <module>
TypeError: unorderable types: str() < int()
This happens right after I enter spam.sort()
I've tried Googling this and using the search function on forums but I can't find anything.
Any help would be greatly appreciated! Thanks!
EDIT: Now that I'm running the Bagels game I can see that the sort() method isn't working in that either. But it's not giving me any errors when running or playing the game.
JacobChristopherMember Since 06 Nov 2012
Offline Last Active Jan 27 2013 01:20 PM
- Group Members
- Active Posts 3
- Profile Views 1,074
- Submitted Links 0
- Member Title Member
- Age Age Unknown
- Birthday Birthday Unknown