+3

# exponentiation

why is the result of 2**5 is not float and 9**1/2 is float ? thanks in advance!!

6/28/2019 8:34:35 PM

Yeabsira Yetagessu

+8

In Python, when using the division operator (/) or doing division of any sort, you always get float, unless you explicitly convert it to a integer, Yeabsira Yetagessu . So 2**5 returns an integer (32) while 9**1/2 (9 to the power of 1 divided by 2) returns a float (4.5) Hope this helps ðŸ˜Š

+1

In Python 3, when you do division the answer will always be a float, unless you do int(9**1/2). This code would evaluate to 4.

+1

Doing a square root will always give a float, even when it would be an integer in the same way that doing a division will give a float even when that would be an integer. 4/2 gives 2.0 and not 2 and, in the same way 9**0.5 gives 3.0 and not 3.

+1

What does it mean ** in python ?

+1

When you square an integer with a float the answer becomes a float These three examples may help you out: 1:Integer * or / Float = Float 4 * or / 2.0 = 6.0 or 2.0 2:Integer * or / Integer = Integer 4 * or / 2 = 6 or 2 3:Float * or / Float = Float 4.0 * or / 2.0 = 6.0 or 2.0

0

while using(/) then u get float value

0

Yeabsira Yetagessu because if the power of the number is integer, the result must be integer. But if the power of the number is float, the result may be integer or float so compiler choice float and there are a different between 9**1/2 and 9**(1/2)

0

If u don't want that float use this(//)

0

x, x=4,7 y, y=x+7,x-7 Print(x, y) What is the output

0

please tell me clearly what is the meaning ** or // in python, why we use double..... please explain it clearly

0

So I get mathematics, tho Exponentiation is grinding my gears.. like I don't get it..

0