A Byte of Python

Chapter 4. The Basics

Table of Contents

Literal Constants
Numbers
Strings
Variables
Identifier Naming
Data Types
Objects
Output
How It Works
Logical and Physical Lines
Indentation
Summary

Just printing 'Hello World' is not enough, is it? You want to do more than that - you want to take some input, manipulate it and get something out of it. We can achieve this in Python using constants and variables.

Literal Constants

An example of a literal constant is a number like 5, 1.23, 9.25e-3 or a string like 'This is a string' or "It's a string!". It is called a literal because it is literal - you use its value literally. The number 2 always represents itself and nothing else - it is a constant because its value cannot be changed. Hence, all these are referred to as literal constants.