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
18 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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
• 6,110 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,320 points
38 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 4 days ago in Python by Mohammad
• 1,400 points
7 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,560 points
55 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
42 views
0 votes
1 answer

how can i count the items in a list?

suppose you have a list a = [0,1,2,3,4,5,6,7,8,9,10] now ...READ MORE

answered May 2 in Python by Mohammad
• 1,400 points
23 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
• 6,110 points
12 views
0 votes
1 answer

ssh first with mysqldb in python

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

answered 1 day ago in Python by ana1504.k
• 6,110 points
9 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.