Explanation:
Step 1: Assign a Value
a = 5
- A variable a is created.
- It stores the integer value 5.
Step 2: Copy the Value
b = a
- The current value of a is assigned to b.
- Now both variables contain 5.
Step 3: Update Variable
a += 3
- This is a shorthand for a = a + 3.
- Python calculates 5 + 3 = 8.
- Now a becomes 8, while b remains 5.
Step 4: Print Both Variables
print(a, b)
- Prints the updated value of a.
- Prints the unchanged value of b.
3. Final Output
8 5
.png)

0 Comments:
Post a Comment