-3

I am learning python and Found that Exponetential Operation is Not performed using ^.

In python

2 ^ 3 != 8

as ^ is Used for Bitwise XOR operations. How can one perform Exponential Function ?

2 ^ 3 != 8

This doesnt Work.

Jagvir
  • 19
  • 1

2 Answers2

0

You're looking for the ** operator:

two_to_the_power_of_three = 2**3
Mureinik
  • 297,002
  • 52
  • 306
  • 350
0

use the power operator '**' , 2 ** 3