Certified Associate in Python Programming (PCAP) — Question 15

Assuming that the V variable holds an integer value to 2, which of the following operators should be used instead of OPER to make the expression equal to 1?

V OPER 1 -

Answer options

Correct answer: C

Explanation

The correct operator is '>>', which is the right shift operator. When you apply '>>' to the integer 2, it shifts the bits to the right, effectively dividing it by 2, resulting in 1. The other options either shift the bits incorrectly or do not produce the desired result.