• Home
  • Python
    • Introduction to Python
    • Python Developer
  • JavaScript
    • Introduction to JavaScript
    • JavaScript Developer
  • React.js
    • Introduction to React
    • React Developer
  • Interactive Training
  • Pricing
  • Brainstorm
STEMTrainingGrounds
  • Courses
    • Home
    • Python
      • Introduction to Python
      • Python Developer
    • JavaScript
      • Introduction to JavaScript
      • JavaScript Developer
    • React
      • Introduction to React
      • React Developer
  • Interactive Training
  • Pricing
  • Brainstorm

Quick Links

  • About Us
  • Pricing
  • Partnership
  • Brainstorm
  • Terms
  • Privacy
  • Refunds

Courses

  • Python
    • Introduction to Python
    • Python Developer
  • JavaScript
    • Introduction to JavaScript
    • JavaScript Developer
  • React
    • Introduction to React
    • React Developer

Newsletter

Subscribe to our free monthly newsletter, for a quick update on Python, JavaScript, and React news

© 2025 - 2026 STEMTrainingGrounds. All Rights Reserved.

Introduction to Python -

Lesson 5 of 16

Lesson Progress: 0%

Lesson Progress: 0%
Lesson Incomplete
← Previous: Variables
Lesson 5 of 16
Next: String Operations →
Code Example
# List of integers
nums1 = [1, 2, 3]
print(nums1)

nums2 = [5, 10, 15]
print(nums2)

Instructions

▼ ← Click the triangle to hide or reveal instructions.

Python Code Editor

Task Incomplete

Editor Input:

Editor Output:

Click "Run Code" to see the output here
  • A list is like a backpack where you can store a whole collection of items together.
  • To make a list, we put all our items inside square brackets [ ].
  • We use commas to separate the items so Python knows where one ends and the next begins.
  • Your list can hold anything! It can be a group of numbers, decimals, or words.
  • When you give your list a name, like pets or colors, you can use it later in your code.
  • Just use print() with the list's name to see everything you stored inside it on the screen.
Code Example
# List of decimals
prices = [1.5, 2.0, 3.25]
print(prices)

heights = [4.2, 5.1, 6.0]
print(heights)

Instructions

▼ ← Click the triangle to hide or reveal instructions.

Python Code Editor

Task Incomplete

Editor Input:

Editor Output:

Click "Run Code" to see the output here
  • Lists are like containers that hold many values together.
  • A list can store decimal numbers like 1.5 or 3.25.
  • Each list here has 3 items inside it.
Code Example
# List of words
pets = ["Cat", "Dog", "Bird"]
print(pets)

colors = ["Red", "Blue", "Green"]
print(colors)

Instructions

▼ ← Click the triangle to hide or reveal instructions.

Python Code Editor

Task Incomplete

Editor Input:

Editor Output:

Click "Run Code" to see the output here
  • Lists are like containers that hold words together.
  • A list can store individual words like "Cat" or "Red".
  • Each list here has 3 words inside it.
Code Example
# List of short sentences
quotes = ["Be kind", "Work hard", "Stay happy"]
print(quotes)

# List of short sentences
facts = ["The sky is blue", "Grass is green"]
print(facts)

Instructions

▼ ← Click the triangle to hide or reveal instructions.

Python Code Editor

Task Incomplete

Editor Input:

Editor Output:

Click "Run Code" to see the output here
  • Lists are like containers that can hold short sentences.
  • A list can store phrases like "Be kind" or "The sky is blue".
  • The first list has 3 sentences, and the second list has 2 sentences.
Code Example
# List Indexing - Picking the first sentence
my_pets = ["I have a cat", "I have a dog", "I have a bird"]
print(my_pets[0])

# List Indexing - Picking the last sentence
my_goals = ["Learn to code", "Play soccer", "Read a book"]
print(my_goals[2])

Instructions

▼ ← Click the triangle to hide or reveal instructions.

Python Code Editor

Task Incomplete

Editor Input:

Editor Output:

Click "Run Code" to see the output here
  • When you have a list of sentences, Python gives each one a "hidden number" to help you find it.
  • The first sentence in your list is always number 0, the second is number 1, and the third is number 2.
  • To grab just one sentence, put its number inside square brackets [ ] right after the list name.
Code Example
# List of different data types
mix1 = [5, "Hello", 2.5]
print(mix1)

mix2 = ["Cat", 10, True]
print(mix2)

Instructions

▼ ← Click the triangle to hide or reveal instructions.

Python Code Editor

Task Incomplete

Editor Input:

Editor Output:

Click "Run Code" to see the output here
  • A list can hold different kinds of things, like numbers and words.
  • We use square brackets [ ] to get one item from a list.
  • Counting starts at 0, so [0] means the first item.
  • print() shows the list or the item on the screen.
Code Example
# List indexing (getting one item from the list)
items1 = [7, "Apple", 3.5]
print(items1[0])

items2 = ["Dog", 4, False]
print(items2[0])

Instructions

▼ ← Click the triangle to hide or reveal instructions.

Python Code Editor

Task Incomplete

Editor Input:

Editor Output:

Click "Run Code" to see the output here
  • Lists can hold different types of things like numbers, words, and even True/False.
  • Each item in a list has a position called an index.
  • The first item in a list always has an index of 0.
  • You can use the index inside [ ] to get one item from the list.
Code Example
# Zip names with ages
names = ["Sam", "Alex"]
ages = [10, 12]

result = list(zip(names, ages))

print(result)

Instructions

▼ ← Click the triangle to hide or reveal instructions.

Python Code Editor

Task Incomplete

Editor Input:

Editor Output:

Click "Run Code" to see the output here
  • The zip() helper is like a zipper on a jacket that pulls two different lists together into pairs.
  • It takes the first item from the first list and matches it perfectly with the first item from the second list.
  • In your loop, you use two names like name, age to hold the two pieces of information at the same time.
  • This is the best way to keep related data together, like matching a person's name with their favorite color or their age.
Code Example
# Zip colors with objects
colors = ["Red", "Blue"]
things = ["Car", "Ball"]

result = list(zip(colors, things))

print(result)

Instructions

▼ ← Click the triangle to hide or reveal instructions.

Python Code Editor

Task Incomplete

Editor Input:

Editor Output:

Click "Run Code" to see the output here
  • zip() is used to join two lists together.
  • It takes one item from each list and pairs them up.
  • The result is groups (pairs), not single items.
  • Each group has one item from each list, like ("Red", "Car").

Test Incomplete

What is a list in Python like?

Question #

1/15

Score

0/0 - 0.0 %