© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2022
M. IndenPython Challengeshttps://doi.org/10.1007/978-1-4842-7398-2_4

4. Strings

Michael Inden1  
(1)
Zurich, Switzerland
 

Strings model character sequences and possess the type str, which offers a variety of functions. In this chapter, you will learn about this topic through various exercises.

4.1 Introduction

Strings consist of single characters and, like lists, are sequential data types (see section 5.1.1), which is why many actions can be performed analogously, such as slicing. Unlike other languages, Python does not have a data type for individual characters, so they are simply represented as strings of length 1.

Strings can be created as character sequences ...

Get Python Challenges: 100 Proven Programming Tasks Designed to Prepare You for Anything now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.