Skip to content
dreamcode
dreamcode
Map
Strings
Lesson 2 of 77
+15 XP on finish
PYTHON BASICSChapter 1 · Python Basics

Words and text

A string is text wrapped in quotes. You can glue strings together with +, repeat them with *, and ask how long one is with len().

Worked example

How it reads

  • + joins strings end to end, so "night" + "sky" becomes "nightsky"
  • * repeats a string, so "night" * 3 is "nightnightnight"
  • len(first) counts the characters, here 5
Cloud tip: Quotes can be "double" or 'single', as long as both ends match.
main.py
PYTHON
real Python, runs in your browser
Console
Run your code to see its output here.
YOUR TURN

Print how many characters are in greeting. It should print 14.

Press Run to check your work.