DRAFT
NoSequenceRepetition
Misconception:
Python has no operator that would allow expressions
to repeat a given sequence a given number of times.
E.g., "Ciao! " * 3
is not a legal Python expression.
Incorrect
There is no operator that repeats sequences
Correct
CorrectionHere is what's right.
Here is what's right.
In Python, the multiplication operator can be used to multiply a sequence by a number. The result of such an expression is a new sequence that corresponds to the given sequence repeated the given number of times.
Here is an example:
print("Ciao! " * 3)
# outputs Ciao! Ciao! Ciao!
Language
Python