Data Types
Integers, floats, strings, booleans, lists, dicts, and more
Knowledge Debt detected
You can study this freely — but your score may plateau if these foundations have gaps. The Mastery badge requires them to be solid.
Explanation
Python has several built-in data types. The most common are:
Numbers: int (whole numbers) and float (decimals). Strings: Text wrapped in single or double quotes: "hello", 'world'. Booleans: True or False — used in conditions. Lists: Ordered, mutable collections: [1, 2, 3]. Dictionaries: Key-value pairs: {"name": "Alice", "age": 30}. Tuples: Ordered, immutable collections: (1, 2, 3). None: Represents the absence of a value.
Use type(x) to check the type of any value.
Examples
Common types
Different data types in Python
age = 25 # int
price = 9.99 # float
name = "Bob" # str
active = True # bool
scores = [95, 87] # list
info = {"city": "NY"} # dict
print(type(age)) # <class 'int'>Next in Programming Fundamentals
Functions