StudyToCert

All certifications / PCAP / Lessons

PCAP – Certified Associate Python Programmer PCAP-31-03 · Domain 3: Strings

Concatenation, replication and comparison of strings (and why comparing strings with numbers using < fails)

▶ Watch the overview video

Last reviewed September 25, 2026 · Leer en español

Two arithmetic operators work on strings with new meanings. + concatenates: 'Py' + 'thon' is 'Python'. Both operands must be strings; 'Age: ' + 30 raises TypeError, so convert first with str(30) or use an f-string. * replicates: 'ab' * 3 is 'ababab', and the order can be swapped, 3 * 'ab'. The other operand must be an integer. Multiplying by 0 or a negative number gives the empty string rather than an error. The augmented forms += and *= work too and, because strings are immutable, they create new strings and rebind the name.

Free account

Keep reading for free

Create a free StudyToCert account to read the rest of this lesson: 5 more sections, 3 key terms, a real-world example, an exam tip and self-check questions. Every lesson, lab and practice test is free with an account.

Sign up free Log in

Study PCAP for free
A week-by-week plan with every lesson, quizzes, checkpoint tests, a practice exam and hands-on labs.
Open the PCAP study plan