O'Reilly logo

Hello World! Second Edition: Computer Programming for Kids and Other Beginners by Warren Sande and Carter Sande

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 4. Types of Data

We have seen that there are at least three different types of things we can assign to a variable (to keep in the computer’s memory): integers, floating-point numbers, and strings. There are other types of data in Python, which you’ll learn about later, but for now these three will do. In this chapter, you’re going to learn how you can tell what type something is. You’ll also see how to make one type from another.

Changing types

Quite often, we need to convert data from one type to another. For instance, when we want to print a number, it needs to be converted to text in order for the text to appear on the screen. Python’s print command can do that for us, but sometimes we need to convert without printing, or to convert ...

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