Slicing Lists

Practice Labs Module
Time
6 minutes
Difficulty
Intermediate

Welcome to the Slicing 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
Required fields are marked with an *
or

Already have an account? Sign In »

Overview

Introduction

Welcome to the Slicing 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 - Slicing the Lists

After completing this lab, you will be able to:

  • Write a program to slice the items in a list
  • Write a program to modify the list items
  • Write a program to use a negative index number to slice the 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 - Slicing the Lists

In Python, you can extract or retrieve the list items by providing the index numbers of the items. This process is known as slicing. You can also modify the list items as desired. The items in a list from left to right will have positive index numbers and from right to left will have negative index numbers. You can slice the list using negative index numbers also.

In this exercise, you will learn to write programs to perform the following tasks:

  • Slice items in a list using positive index numbers.
  • Modify the list items.
  • Slice items in a list using negative index numbers.

Learning Outcomes

After completing this exercise, you will be able to:

  • Write a program to slice the items in a list
  • Write a program to modify the list items
  • Write a program to use a negative index number to slice the list
Learning Partner
Comprehensive Learning

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