Explanation:
Step 1: Understanding "7" * 2
"7" * 2
- "7" is a string, not an integer.
- The * operator repeats a string the specified number of times.
- Here, "7" is repeated 2 times.
Result:
"77"
Step 2: Understanding + "3"
"77" + "3"
- The + operator joins two strings.
- This operation is called string concatenation.
- "77" and "3" are joined together.
Result:
"773"
Step 3: Understanding the print() function
print("7" * 2 + "3")
- First, Python evaluates "7" * 2.
- Then it concatenates the result with "3".
- Finally, print() displays the result.
Final Output:
773
.png)

0 Comments:
Post a Comment