Explanation
Line 1: print("5" + "5")
Part 1: "5"
"5"
"5" is a string (text value).
Even though it looks like a number, the quotation marks make it text.
Part 2: +
"5" + "5"
When + is used between strings, Python performs string concatenation.
Concatenation means joining two strings together.
Part 3: "5" + "5"
"5" + "5"
Python joins the two strings.
Result:
"55"
Part 4: print()
print("55")
print() displays the result on the screen.
Execution Flow
Step 1
"5" + "5"
Step 2
"55"
Step 3
print("55")
Output
55

0 Comments:
Post a Comment