Question Detail

COS 102 Python strings Objective Question

Question

Which operator is used in Python to create multiple copies of a string and join them together?
Options
A <code>+</code>
B <code>*</code>
Correct Answer
C <code>&</code>
D <code>%</code>
Correct Answer

Option B is the correct answer.

Detailed Explanation

The 'Repetition' section (page 7) states, 'Repetition creates multiple copies of a string and joins them together. We use the * operator followed by an integer.'

Hint

Think about the operation that duplicates and joins a string multiple times.

Question Info