Post

@PythonPr Answer: C) Error
The trap: Both are STRINGS!
› a = '9' (string, not number)
› b = '4' (string, not number)
› String * String = TypeError!
For beginners: String * int works ('9'*4='9999'), but string * string doesn't.
English

@PythonPr The correct answer is C) Error.
Why is it an error?
In Python, the * operator is overloaded, meaning it does different things depending on the data types:
Number * Number: Standard multiplication (e.g., 9 * 4 = 36).
String * Integer: String repetition (e.g., '9' * 4 = '9999').
English

@PythonPr Output: C) Error
Why:
In Python, string multiplication works only with an integer (e.g., 'g' * 4).
Here, b = '4' is a string, so a * b raises a TypeError (can't multiply sequence by non-int).
English

@PythonPr a and b are string... when you write '9" * '4', python sees: left and right side sequence (string). It expects the right side to be an int. since it is noy, python riases error
English

@PythonPr error bcoz string string cant be multiplied 😁
TypeError: cant multiply sequence by non-int of type str
English

@PythonPr a is a string
b is also a string
Python does not allow multiplying a string by another string
string * int → string repetition
string * string → TypeError
so output=TypeError
English

@PythonPr C) Error
'9' and '4' are of type (string) and python needs at least one integer(e.g 4) for multiplication to work.
English






























