Primitive Data Types
Python has a number of built-in data types but for the purpose of this notebook, we will focus on what are referred to as primitive data types. The primitive data types are as follows.
- Integer - Whole numbers
- Float - Deciaml numbers
- String - Character data
- Boolean - True or False
- None - None Object or NoneType
Integers
Whole Numbers
# Positive Integer
num = 10
# Check data type
type(num)
int
# Negative Integer
negative_num = -10
# Check data type
type(num)
int
#Zero
zero = 0
# Check data type
type(zero)
int
Floats
# Floating or Decimal Number
decimal_num = 2.5
# Check data type
type(decimal_num)
float
String
# Python String
game_name = "Mario Karts"
# Check game_name type
type(game_name)
str
Boolean
The type() of both False and True is bool.
# Set varable to be False
false_type = False
# Check data type
type(false_type)
bool
None
## Set variable to NONE
none_variable = None
# Check data type
type(none_variable)
NoneType