CHAPTER 8

image

Introduction to Lists

So far this book has shown four types of data:

  • String (a string is short for “string of characters,” which normal people think of as text.)

  • Integer

  • Floating point

  • Boolean

Python can display what type of data a value is with the type function.

This type function isn’t useful for other programming in this book, but it is good to demonstrate the types of data introduced so far. Type the following into the interactive shell. (Don’t create a new window and type this in as a program; it won’t work.)

type(3)type(3.145)type("Hi there")type(True)>>> type(3)<class 'int'>>>> type(3.145)<class 'float'>>>> type("Hi there") ...

Get Program Arcade Games: With Python and Pygame, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.