Skip to content
Home » PYTHON JUMPSTART COURSE Section 1 – Introduction, Lesson 13 – Data Types and Operators

PYTHON JUMPSTART COURSE Section 1 – Introduction, Lesson 13 – Data Types and Operators

Spread the love

Programs process data, which is represented by objects. In Python everything is an object: variables, literals, functions, classes, modules.

In Python we don’t need to (and actually can’t) explicitly declare the data type of a variable. The type is determined at runtime. This feature is known as dynamic typing.

Data Types

There are 3 main kinds of objects:

1) built-in objects – provided by Python

2) objects from extension libraries

3) custom objects – created in the application by the programmer

We’re going to discuss the built-in data types first, also referred to as built-ins. We’re going to talk about the other types later in the course.

Built-In Data Types

Let’s start with the built-in data types. These are types you get out of the box. Here belong:

– numerics

– sequences

– mappings

– files

– instances

– exceptions

These are just general names, or categories. Each of them contains several actual types. Let’s have a look at some of them, starting with numerics.

Built-In Numeric Types

Here we have three types:

– integers (ints)

– floating-point numbers (floats)

– complex numbers

Sequential Data Types

As far as sequences are concerned, you already know strings. But strings are by far not the only sequences in Python.

This category includes:

– strings

– byte sequences

– byte arrays

– lists

– tuples

– range objects

To work with data we also need operators. Let’s have a look at some of the commonly used ones.

Operators

Operators are the constructs used to manipulate operands.

For example in:

3 * 5 – 1

3, 5 and 1 are operands, whereas * and – are operators.

There are many types of operators:

– Arithmetic Operators

– Comparison Operators

– Assignment Operators

– Membership Operators

– Logical Operators

– Bitwise Operators

– Identity Operators

We’re going to explore data types and operators in the following sections of the course, starting with numbers, which are the subject of the next section.


Spread the love

Leave a Reply