0Pricing
Python Academy · Lesson

String Slicing and Concatenation

Master slicing syntax and combining strings.

Introduction

Slicing extracts a substring using [start:stop:step] syntax. Concatenation joins strings together.

Basic Slicing

s[1:4] returns characters at indices 1, 2, 3 — stop is exclusive. s = 'Python'; s[1:4] is 'yth'.
s = 'Python'
print(s[1:4])

All lessons in this course

  1. String Basics and Indexing
  2. String Slicing and Concatenation
  3. Common String Methods
  4. String Formatting with f-strings
← Back to Python Academy