Lesson 2
The Basic Elements
Chapter 4: Objects
Object types
As mentioned, an object has a type.
Python provides the following basic data types.
- Numbers:
int
,float
,complex
- Boolean:
bool
(Something that is eitherTrue
orFalse
) - Strings:
str
(A sequence of characters)
You can check the type of an object using type()
.
>>> type(3)
<class 'int'>
>>> type(5+2j)
<class 'complex'>
>>> type("London")
<class 'str'>