What is the difference between "**" operator and "^"?

when I try to print 8^3 it gives an output of 11. But for my required answer, when I print 8**3 it gives the correct answer of 512. why?

Why is it that 8^3 does not equal 512 as it is the correct answer?

Nov 12, 2018 in Python 618 views

## 1 answer to this question.

When you use "^" operator, it is a bitwise operator, which does "bitwise exclusive or".

The power operator is "**", like 8**3 which equals to 512.
• 7,910 points

## How can I use indices in math using python

Operator ^ is a bitwise operator, which does "bitwise exclusive or". More: http://wiki.python.org/moin/BitwiseOperators The ...READ MORE

## How can I use the power function in python 2.7?

print(pow(3,4)) #this will return the exponentiation of 3 ...READ MORE

## syntaxerror: "unexpected character after line continuation character in python" math

There is a slight confusion as both ...READ MORE

## syntaxerror: "unexpected character after line continuation character in python" math

The division operator is /, not \ READ MORE

## how do i change string to a list?

suppose you have a string with a ...READ MORE

## how can i randomly select items from a list?

You can also use the random library's ...READ MORE

+1 vote

## how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE