Let’s break it down step by step.
Code:
๐น Line 1:
print("5" * 3)"5" is a string.
-
The * operator with a string repeats the string.
"5" * 3 → "5" repeated 3 times → "555"
✅ Output:
๐น Line 2:
print([5] * 3)[5] is a list containing one element (5).
-
The * operator with a list repeats the list.
[5] * 3 → [5, 5, 5]
✅ Output:
[5, 5, 5]

0 Comments:
Post a Comment