© Irv Kalb 2016

Irv Kalb, Learn to Program with Python, 10.1007/978-1-4842-2172-3_7

7. Lists

Irv Kalb

(1)Mountain View, California, USA

Prior to this chapter, we talked about four types of data: integer, float, string, and Boolean. But imagine that you want to represent a lot of data-for example, the names of all the students in a class, or better yet, the names of all students in a school, or a city, or a state. So far, our definition of a variable allows us to only represent a single piece of data. Therefore, if we wanted to represent a group of students’ names, we would do something like this:

student1 = 'Joe Schmoe'student2 = 'Sally Smith'student3 = 'Henry Jones'student4 = 'Betty Johnson'student5 = 'Chris Smith'

Every time we get a new student, ...

Get Learn to Program with Python now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.