anonymous
  • anonymous
What is the difference between a list and a tuple?
MIT 6.00 Intro Computer Science (OCW)
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
chestercat
  • chestercat
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
http://news.e-scribe.com/397
anonymous
  • anonymous
I think that a list is a set of elements that can be numbers or strings, or a subset. a tuple is a sequence of instructions.
anonymous
  • anonymous
One functional aspect is that a list is mutable and a tuple is not.

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

anonymous
  • anonymous
The principal difference is this: a tuple is very much like a list except that it is immutable (i.e. it can't be changed). Both are object types and can be used for grouping data into a single object. Before looking at how they are different let's look at how they are similar: --> Like lists, tuples are *ordered* collections of objects --> Like lists, tuples can embed any kind of object --> Like lists, tuples are accessed by offset and, therefore, support offset-based access operations such as indexing and slicing. If you wanted to use an object that consists of the first 5 prime numbers, you can use either a list or a tuple: a = [2, 3, 5, 7, 11] b = (2,3,5,7,11) Thus, print a[2] print b[2] will give you the same result, namely the number 5 But suppose you want to change a and b to add the next prime number. The following works perfectly for a, which is a list and is *mutable* a.append(13) a has now mutated (i.e. changed) to the object: [2,3,5,7,11,13] Try to change or mutate a tuple and you will get an error message. In fact, you can't perform any operations on tuples which change the object once defined. Why might you use tuples? When you have a set of objects that you are fixed and you don't expect to change throughout the life of your program. For example, if you want to store the letters in the English alphabet. ('a', 'b',....)
anonymous
  • anonymous
given all that, lists have lots of methods and sometimes it makes things easier to turn you tuple into a list then do stuff to it then turn it back into a tuple

Looking for something else?

Not the answer you are looking for? Search for more explanations.