WHAT DOES ** MEANS IN PYTHON? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

WHAT DOES ** MEANS IN PYTHON?

I have seen many questions which contain **. What does it means? Eg:- print(2**8). What would it return?

16th Dec 2022, 9:17 AM
HUMANOID ANIME
HUMANOID ANIME - avatar
19 Answers
+ 9
** power operator in python. 2**3 => 2*2*2 4**4 => 4*4*4*4
16th Dec 2022, 9:21 AM
Jayakrishna 🇮🇳
+ 6
This ** is the same thing as raise to the power of in mathematics e.g 2**3 is also known as 2 raise to the power of 3 = 2*2*2 Hope it was helpful
16th Dec 2022, 9:34 AM
Destiny Eliagwu Simon
Destiny Eliagwu Simon - avatar
+ 6
HUMANOID ANIME print (2**8) will return 256. i.e 2*2*2*2*2*2*2*2 = 256 (2 multiplies itself 8 times) The ** is referred to as the power operator. It multiplies a number a certain number of times by itself base on the number after the ** Jayakrishna🇮🇳 and Destiny Simon has given a nice example.
16th Dec 2022, 12:28 PM
Emms
Emms - avatar
+ 3
they are called exponentiation Exponentiation raises one number (the base) to the power of the other (the exponent). For example, 2**3 is 8, since 2**3 means “give me 2 * 2 * 2” (2 multiplied together 3 times).
17th Dec 2022, 9:37 AM
timi adegun
timi adegun - avatar
+ 3
** is the power of the number
18th Dec 2022, 4:43 AM
MONISH R
MONISH R - avatar
+ 3
Power eg: 2**2 = 4 3**2 = 9
18th Dec 2022, 6:54 AM
Venuja Shanmugarajah
+ 3
It is the power operator calculates the power of a number. 2**2 => square of two, same as 2*2 2**3 => two to the power of three, same as 2*2*2 You can also calculate root by ** operator using 1/number as the exponent 2**(1/2) => square root of two 2**(1/3) => cube root of two Be careful with parenthesis. ** has higher precedence than / 2**1/3 => this does not mean cube root. It is equal to two to the power of 1 and then divided by 3 In general 2 ** (2/3) => cube root of square of 2
19th Dec 2022, 3:30 PM
Sedat Çapar
+ 2
exponential operator: For example: 3**2 = 3*3 Or, 6*4 = 6*6*6*6 Hope you understand the concept of exponent.
18th Dec 2022, 8:45 AM
follow ->
follow -> - avatar
+ 1
Power operator
16th Dec 2022, 10:18 AM
Benazir Luvega
+ 1
It means power of The eg you gave ie, 2**8 means 2 to the power of 8
16th Dec 2022, 10:27 AM
Hirakjyoti Medhi
Hirakjyoti Medhi - avatar
+ 1
Emms noted thanks
16th Dec 2022, 12:38 PM
Destiny Eliagwu Simon
Destiny Eliagwu Simon - avatar
+ 1
When you code this * is in math like this 2*3 and the answer is 6 right well I think then that if you use ** then it will double it that is what I think
16th Dec 2022, 4:54 PM
Hashim Mahdi
+ 1
Exponents
16th Dec 2022, 9:41 PM
Emmanuel Ndema
Emmanuel Ndema - avatar
+ 1
x**y=multiply x, y times
16th Dec 2022, 10:51 PM
Felix Logback
Felix Logback - avatar
+ 1
That's a power operator and returns powers of given number. If we give print(2**5),it return 32 as an answer. As, 2*2*2*2*2 = 32
17th Dec 2022, 9:30 AM
Nakka Sunil
+ 1
It means power , 2 ** 3 is , 2 power 3 , which equal to 8
17th Dec 2022, 2:44 PM
Jebreel Ziadna
Jebreel Ziadna - avatar
+ 1
es el operador de potencia: por ejemplo 2**2 = 4 2**3 = 8 2**4 = 16 2**8 = 256 inténtalo con esto: print(2**2)
17th Dec 2022, 7:14 PM
Miguel Angel Garcia Agudelo
Miguel Angel Garcia Agudelo - avatar
+ 1
When we take for example, 1000 is the answer and print the way of operators Then,10*10*10 =10** When we have to print it in times then, 10**3 Here,3 is ,how many time the element have to be printed Easy 😜👍
18th Dec 2022, 1:16 AM
guna katakam
guna katakam - avatar
0
it acts like an exponetial for example 2^3=8 2**8 will run to 256
18th Dec 2022, 6:53 AM
SSENTONGO ZAKIYU