The arrangement of data within memory forms the basis of computing. The arrangement of data is known as data structure. Every language provides a variety of built-in data structures. Languages such as C provide basic data structure mechanisms, using which complex structures can be built, whereas languages such as Java use a full-blown object-oriented approach for almost all types of data structures. Then there are languages like Python, which takes a middle approach. In this article I will be discussing the middle path used by Python, examining two of its built-in data structures: lists and tuples. The first section will focus on lists, while the second section will focus on tuples. In the final section of this article I will develop a real world application which makes use of lists and/or tuples. That's the agenda for this discussion. More about Lists and Tuples Lists and tuples are two of Python's basic built-in data structures. As with all other features of Python, these in-built data structures provide both flexibility and power. The answer to how flexible and powerful they are is what I am going to discuss now. First let's look at the list data structure.
blog comments powered by Disqus |