YOUR SAVED CODE-ALONG
Code along: Python strings
Keep the lesson open on your other screen. Your edits stay in this workspace, separate from the practice activity. Sign in to save and reload a private account draft across devices, or share a snapshot when you need help.
CODE-ALONG / THEATER MODE
Understand strings
ORIGINAL WALKTHROUGH · 16:28
Watch with Rob.
Pause whenever you want to try a change. You can return to the lesson at any time.
You are signed in, but video access needs attention. Check your account access. Your saved work is kept.
Video walkthroughs are included with an active Code Zone membership. The written lesson and practice are free.
Video settings & progress
Your lesson progress
Empty: not started. Yellow: in progress. Green: complete. Marking the whole activity complete does not replace your test results. These circles save in this browser for this pilot.
Start the video to enable typing controls.
YOUR TURN
Code along: Python strings
Follow the strings video, pausing to type your examples. Try matching single and double quotes, join text with +, then inspect the first character and length of a short name. The written lesson uses Ada; Rob may use different example values. Save your experiments separately from the greeting practice.
Load an example, edit it and run it. Word wrap is enabled.
Your check results
Lesson reference
Examples load into this same code-along only after you confirm replacing your code.
A string is a text value
A Python string is a sequence of characters. You can use matching single or double quotes around ordinary text. The quotes mark where the text begins and ends; print does not display those delimiter quotes.
If your text includes an apostrophe, double quotes around the whole value can make it easier to read. Triple quotes can hold text across several lines, but they still create strings rather than a special comment type.
learner_name = "Ada"
message = "It's time to code."
print(learner_name)
print(message)Joining strings does not insert spaces
The + operator joins strings end to end. Python keeps exactly the characters in each part. Include a space inside a string when you want that space in the result.
The example prints Hello, Ada! with one space after the comma. A number is a different kind of value; joining strings with numbers will need a conversion or formatting technique, which later lessons introduce.
learner_name = "Ada"
greeting = "Hello, " + learner_name + "!"
print(greeting)An index is a position; length is a count
The characters in Ada have indexes 0, 1 and 2. learner_name[0] reads A. len(learner_name) counts all three characters and gives 3. The last index and the total length are different numbers.
Using an index that is outside the string raises IndexError. With Ada, index 3 is already beyond the final character. Start by predicting the first character and length before experimenting in your code-along workspace.
learner_name = "Ada"
print(learner_name[0]) # A
print(len(learner_name)) # 3Creating a new string is different from changing one character
Strings are immutable: you cannot assign a different character with learner_name[0] = "E". You can assign a new string to the learner_name variable instead. The variable can refer to a new value even though a string value itself cannot be edited in place.
The video also previews string operations that later activities revisit. For this checkpoint, explain matching quotes, joining text, index zero and length. Then fix one missing space in the practice activity.
Build it one step at a time
Prefer learning by typing? Work through short instructions, run the Python code and check each change before continuing. Your guided project saves separately from the challenge below.
The mini-lesson opens in a new tab. Your own code carries forward; each step has a focused check and an optional hint.
Start mini-lesson(opens in a new tab)4 steps · Saved work · Instant feedback
See the attached lesson’s comic
