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 40 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. answered Nov 12, 2018 by
• 7,870 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

How can I rename a file in Python?

yes, you can use "os.rename" for that. ...READ MORE

How can I create a new file in Python?

You can try the below code which ...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?

if you google it you can find. ...READ MORE

+1 vote

how can i count the items in a list?

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

how do i use the enumerate function inside a list?

can you give an example using a ...READ MORE