๐Ÿš€ Day 5 of My Python Learning Journey โ€“ Lists, zip(), and enumerate()

Today, I deep-dived into Lists in Python and two powerful functions โ€“ zip() and enumerate().

๐Ÿ”น What are Lists?

Lists are ordered, mutable collections that can store multiple items.

fruits = [“apple”, “banana”, “cherry”]
print(fruits) # [‘apple’, ‘b…


This content originally appeared on DEV Community and was authored by Aditi Sharma

Today, I deep-dived into Lists in Python and two powerful functions โ€“ zip() and enumerate().

๐Ÿ”น What are Lists?

Lists are ordered, mutable collections that can store multiple items.

fruits = ["apple", "banana", "cherry"]
print(fruits) # ['apple', 'banana', 'cherry']

Some useful methods:
โ€ข append() โ†’ add an element
โ€ข insert() โ†’ insert at a specific index
โ€ข remove() โ†’ remove an element
โ€ข sort() โ†’ sort elements
โ€ข reverse() โ†’ reverse the order

๐Ÿ”น enumerate() โ€“ cleaner looping

Instead of using a counter, enumerate() gives both index and value.

fruits = ["apple", "banana", "cherry"]

for index, fruit in enumerate(fruits):
print(index, fruit)

Output:
0 apple
1 banana
2 cherry

๐Ÿ”น zip() โ€“ pairing data

When you want to iterate over multiple lists at once, zip() is a life-saver.

names = ["Alice", "Bob", "Charlie"]
scores = [85, 90, 95]

for name, score in zip(names, scores):
print(f"{name}: {score}")

Output:
Alice: 85
Bob: 90
Charlie: 95

๐ŸŽฏ Why this matters?
โ€ข Lists are one of the most fundamental data structures in Python.
โ€ข enumerate() improves readability.
โ€ข zip() simplifies working with parallel data.


This content originally appeared on DEV Community and was authored by Aditi Sharma


Print Share Comment Cite Upload Translate Updates
APA

Aditi Sharma | Sciencx (2025-09-02T10:43:27+00:00) ๐Ÿš€ Day 5 of My Python Learning Journey โ€“ Lists, zip(), and enumerate(). Retrieved from https://www.scien.cx/2025/09/02/%f0%9f%9a%80-day-5-of-my-python-learning-journey-lists-zip-and-enumerate/

MLA
" » ๐Ÿš€ Day 5 of My Python Learning Journey โ€“ Lists, zip(), and enumerate()." Aditi Sharma | Sciencx - Tuesday September 2, 2025, https://www.scien.cx/2025/09/02/%f0%9f%9a%80-day-5-of-my-python-learning-journey-lists-zip-and-enumerate/
HARVARD
Aditi Sharma | Sciencx Tuesday September 2, 2025 » ๐Ÿš€ Day 5 of My Python Learning Journey โ€“ Lists, zip(), and enumerate()., viewed ,<https://www.scien.cx/2025/09/02/%f0%9f%9a%80-day-5-of-my-python-learning-journey-lists-zip-and-enumerate/>
VANCOUVER
Aditi Sharma | Sciencx - » ๐Ÿš€ Day 5 of My Python Learning Journey โ€“ Lists, zip(), and enumerate(). [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/09/02/%f0%9f%9a%80-day-5-of-my-python-learning-journey-lists-zip-and-enumerate/
CHICAGO
" » ๐Ÿš€ Day 5 of My Python Learning Journey โ€“ Lists, zip(), and enumerate()." Aditi Sharma | Sciencx - Accessed . https://www.scien.cx/2025/09/02/%f0%9f%9a%80-day-5-of-my-python-learning-journey-lists-zip-and-enumerate/
IEEE
" » ๐Ÿš€ Day 5 of My Python Learning Journey โ€“ Lists, zip(), and enumerate()." Aditi Sharma | Sciencx [Online]. Available: https://www.scien.cx/2025/09/02/%f0%9f%9a%80-day-5-of-my-python-learning-journey-lists-zip-and-enumerate/. [Accessed: ]
rf:citation
» ๐Ÿš€ Day 5 of My Python Learning Journey โ€“ Lists, zip(), and enumerate() | Aditi Sharma | Sciencx | https://www.scien.cx/2025/09/02/%f0%9f%9a%80-day-5-of-my-python-learning-journey-lists-zip-and-enumerate/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.