Skip to content

Lesson 04 · Python

Python Foundations: Strings, Slicing & Comprehensions

Work with text using strip, split, join and replace, slice strings and lists with start:stop:step, and build new lists with comprehensions.

Prerequisites: Python Foundations: Lists, Tuples, Dicts & Sets

Learning objectives
By the end of this lesson, you will be able to:
  • Clean text with strip, lower, split, join and replace
  • Slice strings and lists with start:stop:step, including negatives
  • Test membership with in on strings and lists
  • Build filtered lists with comprehensions
  • Judge when a plain loop reads better than a comprehension