Revise Computingrevisecomputing.co.uk
At a glanceFeaturesStudentsPricingHow it worksFree GCSE notesExam dates
At a glanceFeaturesStudentsPricingHow it worksFree GCSE notesExam dates

Knowledge organisers / Arithmetic Operators

Exponentiation

All topicsPractise exam questions
Knowledge organiser

Arithmetic Operators

301.2c

Use powers in code.

What you need to know

The ** operator raises a number to a power. It is Python's equivalent of the mathematical exponent notation.

Key points

  • ** means 'to the power of': 2 ** 3 → 8
  • Can be used for squares: n ** 2
  • Can be used for square roots: n ** 0.5
  • Evaluated before * and / in precedence

Code examples

Exponentiation
python
print(2 ** 3)    # 8
print(5 ** 2)    # 25
print(9 ** 0.5)  # 3.0 (square root)