anonymous
  • anonymous
Hello guys! I noticed that Guttag uses lists in many cases where - seemingly - tuples would work as well. When I write code I'm trying to avoid mutable data objects whenever it's possible but I was just wondering if there's any particular reason why lists may be preferable in general? (Maybe something about memory requirements? )
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!
harsimran_hs4
  • harsimran_hs4
lists in general are more easier to work and handle......you can easily refer to an element, pop out a element from list , add elements , overwrite elements(replace with new ones) etc. certainly all these features are not available in tuples and lists have an advantage where we need to constantly modify the stored data be it add elements or refer to them. as regarding memory requirements someone else may better answer it
anonymous
  • anonymous
tuples have a memory advantage I think
anonymous
  • anonymous
lists are dynamically sized, tuples are not

Looking for something else?

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

More answers

KonradZuse
  • KonradZuse
It seems like a tuple would be an array(n-tuple)? I've heard the term in discrete and calc and such. From above it says tuples cannot modify the data within(stacks,queues,etc) but Arrays can... Arrays aren't a list I don't believe.
anonymous
  • anonymous
A list takes up more bytes than a tuple, and a tuple is immutable. That would seem to argue for using tuples unless you need to be able to append or assign values to elements. I find lists easier to work with.
MicroBot
  • MicroBot
not sure why prof. Guttag uses list over tuples but the following link gives some info about their differences and uses. http://news.e-scribe.com/397 hope it helps
anonymous
  • anonymous
Lists vs Tuples is very much about what you need them for, If you want a variable that you do not want to accidentally change use a tuple for constants, (For style, constants variable names are written in uppercase i.e. EARTH_RADIUS = 6 378.1) If you want to change / add to / remove from you need mutability, a list would be better.

Looking for something else?

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