© Valentina Porcu 2018
Valentina PorcuPython for Data Mining Quick Syntax Referencehttps://doi.org/10.1007/978-1-4842-4113-4_3

3. Basic Objects and Structures

Valentina Porcu1 
(1)
Nuoro, Italy
 

One of the most important features of Python is managing data structures. Let’s take a look at them.

Numbers

The numbers in Python can be any of the following:
  • Integers, or int

  • Floating points, or float

  • Complex

  • Booleans—that is, True or False

Let’s look at some examples:
# create an object containing an integer (int)
>>> n1 = 19
>>> type(n1)
<type 'int'>
# a float
>>> n2 = 7.5
>>> type(n2)
<type 'float'>
# a Boolean (True/False)
>>> n3 = True
>>> type(n3)
<type 'bool'>
# a complex number
>>> n4 = 3j
>>> type(n4)
<type 'complex'>

Container Objects

At the heart of Python are the various ...

Get Python for Data Mining Quick Syntax Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.