
Data Types in Python – Part 2
In Part 1, we learned about numeric, string, and Boolean data types. Now let's look at Python's collection data types.
1. List (list)
A list is used to store multiple values in one variable.
fruits = ["apple", "banana", "mango"]
print(fruits)Output:
['apple', 'banana', 'mango']Lists are ordered and changeable.
2. Tuple (tuple)
A tuple is also used to store multiple values, but its values cannot be changed after creation.
colors = ("red", "green", "blue")
print(colors)Output:
('red', 'green', 'blue')3. Set (set)
A set stores multiple values and does not allow duplicate values.
numbers = {1, 2, 3, 3}
print(numbers)Output:
{1, 2, 3}4. Dictionary (dict)
A dictionary stores data using key-value pairs.
student = {
"name": "Vishnu",
"age": 21
}
print(student)Output:
{'name': 'Vishnu', 'age': 21}5. None (NoneType)
None represents no value.
result = None
print(result)Output:
NoneJoin Techsnap Creators
Share your knowledge and earn ??
Want to showcase your tech expertise and get rewarded for your insights? Join the Techsnap creator network!
Write insightful blogs, stay ahead of industry trends, and grow your professional brand while helping others in the community.
Ready to make an impact?

Comments