Lesson 10
Introduction to Lists
Store and loop through collections
1What is a List?✨
A list in Python is a collection of items stored in a single variable. Lists can hold different types of data, making them very flexible and useful for organizing information!
2Why Use Lists?🎯
- ✓ Store multiple items in one variable
- ✓ Easily loop through items
- ✓ Modify, add, or remove items
- ✓ Ideal for managing data like names, scores, and more
3Creating a List💡
You create a list by placing items inside square brackets, separated by commas. Here’s how you can create a list of fruits:
fruits = ["apple", "banana", "cherry"]
print(fruits)This code will display the entire list of fruits.
4Accessing List Items🚀
You can access items in a list using their index, which starts at 0. Here’s how to get the first fruit in the list:
print(fruits[0])This will output "apple" since it is the first item in the list.
5Looping Through a List🔍
You can use a for loop to go through each item in a list. Here’s an example that prints each fruit:
for fruit in fruits:
print(fruit)This loop will display each fruit on a new line.
6Modifying a List⭐
Lists are mutable, meaning you can change them! You can add items with the append() method. Let’s add a new fruit:fruits.append("orange")
print(fruits)Now the list will include "orange" at the end!
🎯 Practice Challenges
Master Introduction to Lists by completing all 3 difficulty levels
Introduction to Lists - Easy Challenge
Start with the basics. Perfect for beginners!
Introduction to Lists - Medium Challenge
Get more challenging. Build your confidence!
Introduction to Lists - Hard Challenge
Master this concept. Prove your skills!
🏆 Study a lesson for 2+ minutes to earn +10 TalentJR Points a day. Badges, certificates & prizes →
Ready to Master Introduction to Lists? 🚀
Complete the challenges, take the quiz and keep your learning streak going!
Keep learning
- ← Previous lessonLesson 9: The Modulo OperatorFind remainders and detect patterns
- Next lesson →Lesson 11: Looping Through ListsProcess every item in a list
- Grade 7 coursePython Functions & DataPython coding course for kids.
- Student ToolsFree calculators for studentsPercentage, fraction, ratio and marks calculators with steps.
- CBSEClass 6 CBSE & NCERT study materialMaths, Science and Computer chapters with solutions.
- Future SkillsExplore future skillsAI, robotics and new-age skills explained for students.