liveBook · Manning

Primitive data type

As explained in Get Programming: Learn to code with Python

A primitive data type is a fundamental, language-provided type for representing a basic value, rather than a composite of multiple values.

A primitive is a basic, built-in type that represents a kind of value. A type determines which values an object can have and which operations you can use with it. In Python, other object types can be built from combinations of five primitives. section 5.2

Python’s five primitive types are:

  • Integers, floating-point numbers, Booleans, strings, and a type for the absence of a value. section 5.2
a = 1
b = 1.0

Compare the values: 1 is an integer, while 1.0 is a floating-point number. section 5.2

Integer values include 0, 5, and -4. You can use arithmetic such as addition and subtraction, then assign the result to a variable. section 5.2

How Get Programming: Learn to code with Python covers it

How deep it goes
Defines object types and names five Python primitives, then explains integer values and arithmetic.
Examples
Uses integer values, arithmetic assignments, and the comparison between 1 and 1.0.
What you can do after
Understand how basic Python values are grouped into types and how integers support arithmetic.
How it connects
Connects primitive types to object types, integers, floating-point numbers, Booleans, strings, and absence of a value.

Also explained in

Compare how 6 books explain primitive data type →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Get Programming: Learn to code with Python. The section links point to the parts of the book it draws on.