Lists
Storing Multiple Items with Lists
Learning Goals
The Core Concept
Lists are ordered, mutable (changeable) collections of items. They can hold items of different data types and are one of the most frequently used data structures in Python.
Visual guide
Python automation process
A simple original diagram to connect the lesson idea with real project flow.
Code & Implementation
fruits = ["apple", "banana", "cherry"]
fruits.append("orange")
fruits[1] = "blueberry"
print(fruits)Expected Output
['apple', 'blueberry', 'cherry', 'orange']
Expense Manager
Hands-on practice task
The Challenge
Build an application to track user expenses. Users should be able to add an expense, view all expenses, and see the total money spent.
Helpful Hints
- •Use a list of dictionaries to store expenses, e.g., {'item': 'food', 'cost': 15}.
- •Create a menu using a while loop.
- •Write functions to add expenses and calculate the total.
Quick Knowledge Check
Can a list contain lists?
Continue Learning
Next steps after this lesson
Build an application to track user expenses. Users should be able to add an expense, view all expenses, and see the total money spent.
Supercharge your career workflows!
Discover free online utilities to format data, build job applications, and automate your productivity routine with TechIdea.