Skip to main content

Indexing and Slicing Python Strings

Hands-On Lab

 

Photo of Keith Thompson

Keith Thompson

DevOps Training Architect II in Content

Length

00:30:00

Difficulty

Beginner

Accessing characters, whether they are single or multiple, is an essential skill for working with strings in any programming language. In Python, we do this by indexing and slicing the string. In this hands-on lab, we'll go through writing some code to demonstrate that we understand how to use indexing and slicing by printing out different pieces of information about a string back to the user. To feel comfortable completing this lab you'll want to be familiar with the following: Working with string literals: Watch the "Strings and String Operators" video from the [Certified Entry-Level Python Programmer Certification][1] course. Indexing and slicing strings: Watch the "String Indexing and Slicing" video from the [Certified Entry-Level Python Programmer Certification][1] course. * Printing to the screen: Watch the videos from the "Input and Output Operations" section of the [Certified Entry-Level Python Programmer Certification][1] course. [1]: https://linuxacademy.com/cp/modules/view/id/413

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.