nerdexam
Python_Institute

PCEP-30-02 · Question #73

The ** operator:

The correct answer is D. performs exponentiation. In Python, ` is the exponentiation operator, meaning it raises the left operand to the power of the right operand - for example, 2 3 evaluates to 8 (2 raised to the power of 3). Option A is wrong because "duplicated multiplication" isn't a real operation, and while…

Question

The ** operator:

Options

  • Aperforms duplicated multiplication
  • Bdoes not exist
  • Cperforms oating-point multiplication
  • Dperforms exponentiation

How the community answered

(18 responses)
  • A
    6% (1)
  • B
    11% (2)
  • C
    6% (1)
  • D
    78% (14)

Explanation

In Python, ** is the exponentiation operator, meaning it raises the left operand to the power of the right operand - for example, 2 ** 3 evaluates to 8 (2 raised to the power of 3). Option A is wrong because "duplicated multiplication" isn't a real operation, and while exponentiation can be thought of as repeated multiplication, that's not what the operator is called. Option B is simply false - ** absolutely exists in Python (and many other languages). Option C is wrong because ** works with both integers and floats, and floating-point multiplication is handled by the regular * operator.

Memory tip: Think of the two stars as a "power tower" - the second * is stacked on top of the first, just like how exponentiation "stacks" multiplication on top of itself. 2 ** 3 = "2, three levels high" = 8.

Community Discussion

No community discussion yet for this question.

Full PCEP-30-02 Practice