Explanation:
๐น Line 1: Call print()
print("5" * 3)
Python first evaluates the expression inside print():
"5" * 3
๐น Step 1: Identify the Data Types
First operand:
"5"
Type:
str
Second operand:
3
Type:
int
Since the left operand is a string, Python knows that * means string repetition, not multiplication.
๐น Step 2: Perform String Repetition
Python repeats the string "5" exactly 3 times.
Internally, it's similar to:
"5" + "5" + "5"
Result:
"555"
Output:
555

0 Comments:
Post a Comment