Creating Lists

Practice Labs Module
Time
6 minutes
Difficulty
Intermediate

Welcome to the Creating Lists Practice Lab. In this module, you will be provided with the instructions and devices needed to develop your hands-on skills.

Join over 3 million cybersecurity professionals advancing their career
Sign up with
or

Already have an account? Sign In »

Overview

Introduction

Welcome to the Creating Lists Practice Lab. In this module, you will be provided with the instructions and devices needed to develop your hands-on skills.

Learning Outcomes

In this module, you will complete the following exercise:

  • Exercise 1 - Working with Lists

After completing this lab, you will be able to:

  • Write a program to create a list
  • Write a program to access specific items of a list

Exam Objectives

The following exam objective is covered in this lab:

  • 1.2 Perform data and data type operations

Lab Duration

It will take approximately 15 minutes to complete this lab.

Exercise 1 - Working with Lists

A list is a data structure in Python that can store an ordered sequence of related elements. Think about your song playlist, your emails, or any such collections of items you have.

Clearly, lists are useful when you want to keep related data together and work on it as a set. They help you perform the same methods and operations on multiple values at once, thereby helping you to condense your code. For example, all student names in the class could be stored as a list. Once done, you could print the complete list of student names all at once.

Each element or value that is inside of a list is called an item. As an ordered sequence of elements, each item in a list can be called individually, through indexing.

Internally, lists can be thought of as a compound data type made up of smaller parts. They are very flexible and enable individual items to be added, removed, and changed.

In this exercise, you will learn to write programs to create and print lists. You will also learn to access individual elements from a list and print them.

Learning Outcomes

After completing this exercise, you will be able to:

  • Write a program to create a list
  • Write a program to access specific items of a list
Learning Partner
Comprehensive Learning

See the full benefits of our immersive learning experience with interactive courses and guided career paths.