Back
+10 XP
Concept

Repeating Strings (*)

Multiply text by a number, and Python repeats it like an annoyed parrot.

python
divider = "-" * 10
laugh = "ha" * 3
print(divider)
print(laugh)

# 27. Repeating Strings (*) Multiply text by a number, and Python repeats it like an annoyed parrot: ```python divider = "-" * 10 laugh = "ha" * 3 print(divider) # ---------- print(laugh) # hahaha ``` Multiply by 0 or negative, and you get an empty string `""` without crashing.

Checkpoint

What does `"ha" * 4` spit out?

Practice

Create a line divider made of 20 equals signs (`"=" * 20`) and print it.

Terminal
01
Tap code blocks below to assemble
Available Blocks