Text06-SequencesListsTuple.docx - Chapter VI Python Data Structures String List and Tuple Chapter VI Topics 6.1 Introduction to Data Structures 6.2 The

# Text06-SequencesListsTuple.docx - Chapter VI Python Data...

This preview shows page 1 - 4 out of 45 pages.

Chapter VI Python Data Structures, String, List and Tuple Chapter VI Topics 6.1 Introduction to Data Structures 6.2 The String Data Structure 6.3 The List Data Structure 6.4 The Tuple Data Structure 6.5 Creating Procedures with Data Structures 6.6 Comparing Python's String, List & Tuple Chapter VI Sequences With Strings, Lists and Tuples Page 1
6.1 Introduction to Data Structures Early in the course you were introduced to simple data types, like integers, real numbers and Booleans. A simple or primitive data type variable creates a location in memory that stores a single value that can be used by a computer program. Single values are practical for loop counter variables, maximum number of grades, the height of Pikes Peak and the exact number of medals won by the United States at the last Olympics. Programs that handle passenger airline reservations, student college transcript requests, employee payroll records, IRS tax records and hospital patient information, require massive data storage. Such major storage requirements cannot be handled efficiently by thousands of simple data type variables, each storing a single value. You will need more sophisticated data types. There are many situations where data needs to hold more than one value. Such a situation calls for using a data structure . So what is a data structure? Look at a building. Note that it is made up of smaller structures like rooms, halls, stairways, etc. A room is made up of walls, floors, ceilings, desks, chairs, etc. Another example can be found with animals. Animals are organisms made up of organ systems . Each organ system is made up of organs . Organs are made up of tissues , and tissues are made up of cells . We could continue and work down to the molecular and atomic level, but for this analogy, assume that the cell is the simplest, lowest level. The whole point is that the structure - an organism in this case - is made up of other - smaller structures - until eventually you reach the smallest component. These two examples are used to motivate the definition of a data structure. In computer science it really is the same idea. The only difference in structures is the nature of the smallest building block used to create the structure. In an animal organism it is a cell. In a building it may be a brick or a plank and in a computer science, integers, reals, characters and Booleans are simple data types. Data Structure Definition A data structure is a data type whose components are smaller data structures and/or simple data types. Data Structure Simple Definition Any data type that can store more than one value is a data structure. Page 2 ExpoCS for AP ® Computer Science Principles 07-14-18
There are many different data structures in most program languages. It is not the intention of the survey AP Computer Science Principles course to explore many data structures. Data Structures is a major topic in Computer Science and offered as a stand-alone semester course in most universities. In this course, and this chapter, you will see three data structures, which are the String, List and Tuple. All three of these data structures are supported by the Python program

#### You've reached the end of your free preview.

Want to read all 45 pages?

• Winter '15
• Aisha
• Formal language, Type theory