Post

@PythonPr Option B : 1010
a is a string, not a number. In Python, multiplying a string by an integer repeats the string. So "10" * 2 becomes "1010". The print statement outputs 1010, not 20, because no numeric multiplication occurs here.
English

@PythonPr Output: B. 1010
Because a is a string ("10") and b is an int (2).
In Python, string * int means repeat the string
English

Floats are rejected because the Sequence Protocol requires discrete indexing; partial repetition breaks UTF-8 encoding boundaries—how do you render 0.5 of a multi-byte character? Negatives are clipped to zero in the CPython source (string_repeat) to maintain Total Function semantics and avoid breaking dynamic loops.
If we allowed 1.5x, would it be s + s[:len(s)//2]? That breaks the Algebraic Monoid properties where (s*a)*b must equal s*(a*b). Integer-only domains keep the math clean.
English

@PythonPr The apostrophe turns 'a' value into a string hence the answer is error
English





























