O'Reilly logo

Program Arcade Games: With Python and Pygame, Fourth Edition by Paul Vincent Craven

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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") ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required