Book Image

Getting Started with Python and Raspberry Pi (Redirected from Learning Python By Developing Raspberry Pi Applications)

By : Dan Nixon
Book Image

Getting Started with Python and Raspberry Pi (Redirected from Learning Python By Developing Raspberry Pi Applications)

By: Dan Nixon

Overview of this book

Table of Contents (18 chapters)
Getting Started with Python and Raspberry Pi
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Data structures


Data structures are containers that hold multiple variables, depending on the particular use case. There are multiple different data structures that can be used which we will now take a look at.

Lists

Lists are probably the most basic data structure; it is simply a list of variables that are numerically indexed by their position in the list.

Lists are most easily compared to array types that can be found in the other programming languages. However, they have the following properties that should be noted:

  • Zero indexed: The numerical indices of lists start from 0 (as per the majority of other programming languages) rather than 1.

  • Dynamically sized: Lists do not have a fixed size so they can grow to hold any number of elements.

  • Type agnostic: Lists do not care about the type of the value that is stored within them (as the type is defined by the instance rather than the container). This means that there is no requirement for the values held in a list to be of the same type.

Creating...