LessonPort Python Strings LabAP Computer Science · real Python syntax
SCORE0STREAK0

PYTHON · STRINGS

Build meaning
one character at a time.

A string is an ordered sequence of characters. Use indexes to access one character, slices to create substrings, and concatenation to combine strings.

Learning target Trace Python string expressions and explain indexing, slice boundaries, concatenation, and string immutability.

LAB 1 · CHARACTER INDEXING

Select one character by index

Change the string, choose a positive or negative index, and run the Python expression.

0C-16
1O-15
2M-14
3P-13
4U-12
5T-11
6E-10
7R-9
8-8
9S-7
10C-6
11I-5
12E-4
13N-3
14C-2
15E-1
Valid indexes: -16 through 15
PYTHON EXPRESSIONtext[0]
PYTHON EXPLAINS

Choose an index, then run the expression.