Read this StackOverFlow answer: http://stackoverflow.com/a/626871
Also read the links referenced in it. You really should read through the documentation and look for answers on StackOverflow. You will easily find a lot of information there. Thanks and regards, Prashant Sethi On Tue, Oct 4, 2016 at 5:41 PM, Noufal Ibrahim <nou...@nibrahim.net.in> wrote: > On , Siva Ranganath wrote: > >> Hi All, >> >> please let me know few cases when we will go with Lists and tuples in >> pyhton. >> > > Lists are like vectors (since you're from a C++ background). They can > expand/contract depending on data and are also heterogeneous meaning that > all the elements needn't be of the same type. It's a flexible container for > holding things. Lists are often iterated over (e.g. for i in all_documents) > or indexed (e.g. students[5] to get the fifth student). > > Tuples are more like C structures in that they're used to hold a few > related things together. They have several behaviours similar to a list > (can be indexed, iterated over etc.) but are not mutable (you can't > add/remove elements from them). However, they're often used differently. > They're used as C structs but without names for the fields. So, points in > 2D space (x,y) are a good candidate for a tuple or maybe a colour in RGB > colourspace denoted by (r,g,b). > > For a more in depth discussion, you should look at the official python > tutorial at https://docs.python.org/3.6/tutorial/ > _______________________________________________ > BangPypers mailing list > BangPypers@python.org > https://mail.python.org/mailman/listinfo/bangpypers > _______________________________________________ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers