1(xv)
What will be the output of the following Python code?
x = 5
print(x + 2)
- (a)5
- (b)2
- (c)7
- (d)52
Show SolutionHide Solution↓
7
Reason — The variable x stores the integer value 5. In the statement print(x + 2), the + operator acts as the arithmetic addition operator because both operands are integers. So the expression is evaluated as 5 + 2 = 7.