Explanation:
x is a string:
-
When you multiply a string by an integer:
It repeats the string 0 times, which means no characters are printed.
✅ Output:
Summary:
In Python:
"abc" * 3 → "abcabcabc"
"abc" * 0 → "" (empty string)
So, print(x * 0) prints nothing, but it doesn't cause an error.


0 Comments:
Post a Comment