Data Types Overview0%
Data Types Overview
Beginner9 min read•Updated: 2026-09-03
Data Types Overview
Data types define the kind of value an object holds and the operations that can be performed upon it.
Key Concepts & Detailed Explanation
Python data types are divided into:
- 1Numeric: int, float, complex
- 2Text: str
- 3Boolean: bool (True, False)
- 4Sequences: list, tuple, range
- 5Mappings: dict
- 6Sets: set, frozenset
- 7Binary: bytes, bytearray
- 8Null Value: NoneType (None)
Code Examples & Output
Python
# Scalar types
age = 22 # int
height = 5.9 # float
name = "Neha" # str
graduated = True # bool
diploma = None # NoneType
# Collection types
hobbies = ["Coding", "Chess"] # list (mutable)
geo_coords = (27.17, 78.00) # tuple (immutable)
languages = {"Python", "SQL"} # set (unique)
user = {"name": name, "age": age} # dict (key-value)
print("Types:", type(age), type(height), type(hobbies))
Expected Output:
Output
Types: <class 'int'> <class 'float'> <class 'list'>
Best Practices & Common Pitfalls
Use type(variable) in the terminal anytime you need to inspect an unknown value.
Practice Quiz
1. Which type is mutable in Python?
- A) tuple
- B) str
- C) list
- D) int
Answer: C
Explanation: Lists are mutable; their elements can be changed in place.
2. What is the data type of the value None in Python?
- A) null
- B) NoneType
- C) void
- D) empty
Answer: B
Explanation: None belongs to <class 'NoneType'>.
Practice Challenge
Declare one variable for each of the 6 fundamental data types and print their types.
Next Lesson
Type Conversion (Casting & type())
Continue learning with hands-on practice, examples, and exercises in the upcoming topic.
Related Lessons
| Previous Lesson | Next Lesson |
|---|---|
| Constants (Python Convention) | Type Conversion (Casting & type()) |
Practice Quiz
Test your understanding of this lesson with 1 questions. Each question has one correct answer.