Vidyalelo
Python · Q31

Python Introduction and basic

Programming · Python · question 31

Q31

What will be the value of the following Python expression? 4 + 3 % 5

A.
7
Answer
B.
2
C.
4
D.
1

Answer: Option A

Solution

Answer: Option A
Solution:
The expression 4 + 3 % 5 evaluates to 7 in Python.

Here's the breakdown:
#1.     3 % 5 calculates the remainder when 3 is divided by 5, which is 3.
#2.     4 + 3 then adds 4 to the result of the modulo operation, resulting in 7.

Therefore, the value of the expression is 7.