Data Types

A variable can store various types of data, called a data type. Lets introduce some of the basic types we’ll be looking at.


An integer is a whole number, and can be positive or negative. Integers can usually be of unlimited length.

score = 45

Floating Point Numbers

A floating point number, sometimes called a real number, is a number that has a decimal point.

temperature = 44.7


In Python code, a string must be enclosed in quotes “…” or ‘…’

name = “John Myers”


A set is an unordered collection of unique items enclosed in curly braces { }. Sets can contain different types.

You can create a set like this:

setName = {1, 6, 2, 9}


A tuple is similar to a list and is a sequence of items each identified by an index. As with lists, the index starts with 0 not 1.

In contrast to lists, items in a tuple can’t be changed once assigned and tuples can contain different types of data.

To create a tuple enclose the items inside parentheses ( ).

userDetails = (1, ‘John’, ‘123 May Road’)


A dictionary is an unordered collection of items, each identified by a key.

To create a dictionary, enclose the items inside braces { }. Identify each item with a key using a colon.

dictionary = { 1: ‘Dave’,
2: ‘Jo’
3: ‘Jane’

To read a value, put the key in square brackets.

print (dictionary[1])

Read page 28 – 34 of the textbook “Python for Beginners”.