CBSE Class 11 Computer Science Question 5 of 19

Strings in Python — Question 1

Back to all questions
1
Question

Question 1

How does '*' operator behave on strings?

Answer

The * operator creates a new string by repeating multiple copies of the same string.

For example,

string = "abc"
repeated_string = string * 3
print(repeated_string)
Output
abcabcabc

In the above example, the string "abc" is repeated 3 times to produce "abcabcabc".