How can I use indices in math using python

0 votes
I want to print 2^3=8 in python

how can I do that?
Dec 11, 2018 in Python by charlie_brown
• 7,780 points
149 views

1 answer to this question.

0 votes

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

The power operator is **, like 8**3 which equals to 512.
Ref: http://docs.python.org/reference/expressions.html#the-power-operator

answered Dec 11, 2018 by aryya
• 7,380 points

Related Questions In Python

+2 votes
3 answers

How can I play an audio file in the background using Python?

down voteacceptedFor windows: you could use  winsound.SND_ASYNC to play them ...READ MORE

answered Apr 3, 2018 in Python by charlie_brown
• 7,780 points
6,467 views
0 votes
3 answers

How can I use grep in Python?

Hello,  Here goes a short demonstration on How ...READ MORE

answered Jul 1 in Python by Nagaraj

edited Jul 2 28,770 views
0 votes
1 answer

How can I write code to find a palindrome in python without using string functions?

In Logic 1, try if i<int(length/2): instead of if i<int((length/2+1)): In ...READ MORE

answered Jan 16, 2019 in Python by charlie_brown
• 7,780 points
8,271 views
0 votes
1 answer

How can I have only positive decimal numbers in Django using Python?

Hi, are you aware of something called ...READ MORE

answered Jan 30, 2019 in Python by Nymeria
• 3,520 points
2,433 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, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,468 views
0 votes
0 answers
+4 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,800 points
1,098 views
0 votes
1 answer

How can I define a multidimensional array in python using ctype?

Here's one quick-and-dirty method: >>> A = ((ctypes.c_float ...READ MORE

answered Oct 9, 2018 in Python by aryya
• 7,380 points
1,212 views
0 votes
2 answers

How can I rename multiple files in a certain directory using Python?

import os from optparse import OptionParser, Option class MyOption ...READ MORE

answered Jul 28 in Python by The real slim shady
2,330 views