Power Math in Python

0 votes

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 by Sayantini
• 140 points
44 views

1 answer to this question.

0 votes
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 ana1504.k
• 7,870 points

Related Questions In Python

0 votes
1 answer

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

answered Dec 11, 2018 in Python by ariaholic
• 7,340 points
63 views
0 votes
1 answer

How can I use the power function in python 2.7?

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

answered May 20 in Python by Mohammad
• 3,060 points
33 views
+3 votes
7 answers

How can I rename a file in Python?

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

answered Mar 31, 2018 in Python by DareDev
• 6,810 points
190 views
+2 votes
2 answers

How can I create a new file in Python?

You can try the below code which ...READ MORE

answered Mar 31, 2018 in Python by anto.trigg4
• 3,420 points
115 views
+1 vote
2 answers

how can i count the items in a list?

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

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 328 views
0 votes
1 answer

% operator in Python

When you use '(%g,%g)', it is the ...READ MORE

answered Nov 12, 2018 in Python by ana1504.k
• 7,870 points
43 views
0 votes
1 answer

ssh first with mysqldb in python

Setup an ssh tunnel before you use ...READ MORE

answered May 23 in Python by ana1504.k
• 7,870 points
721 views