Lists and Tuples

Paul Rubin http
Fri Dec 5 06:31:12 CET 2003


Jeff Wagner <JWagner at hotmail.com> writes:
> I've spent most of the day playing around with lists and tuples to
> get a really good grasp on what you can do with them. I am still
> left with a question and that is, when should you choose a list or a
> tuple? I understand that a tuple is immutable and a list is mutable
> but there has to be more to it than just that.  Everything I tried
> with a list worked the same with a tuple. So, what's the difference
> and why choose one over the other?
        

Try this with a list:

  a = [1, 2, 3, 4, 5]
  a[3] = 27
  print a

Then try it with a tuple.




More information about the Python-list mailing list