Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Everything posted by JacobChristopher

  1. 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: http://inventwithpyt.../chapter11.html 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'] >>> spam.sort() >>> spam [1, 2, 3, 4, 5, 'ape', 'bat', 'cat'] I fully understand what the sort() method does, but it is giving me this error: [color=#ff0000]Traceback (most recent call last): File "<pyshell#35>", line 1, in <module> spam.sort() 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.
  2. JacobChristopher

    Python 3.3.0 sort() method not working?

    Thanks for this! I don't 100% understand this yet, but I've written it down in my notes. It'll click eventually. That's what I'm starting to realize is happening. I'll understand half of what I'm learning right away, and the other half I'm like "ummmmmmm, I kinda get it but not all the way..." and then all of a sudden when a very similar function is being defined I get an "a-ha!" moment. Then I go back to what I was having trouble with and it's no sweat. As lame as it sounds, this is very exciting to me haha. What you should do, is install the correct version of Python for your tutorial (or find a tutorial that is meant for Python 3.x). There are enough differences between Python 2.x and 3.x to make your learning process a nightmare if you persist with the current tutorial/Python mismatch. [/quote] The inventwithpython.com book says to download Python 3.1. I didn't think that there would be too much of a difference between that and 3.3, but looks like I was wrong! The only 3.1 version they have for download is 3.1.5 so I'll give that a try. Thanks!
  3. JacobChristopher

    Python 3.3.0 sort() method not working?

    Thanks for the quick reply. So is there a workaround I should learn or should I just skip this and continue on learning? Being completely new to this, I have no idea how important or not important sort() is/was.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!