+ 3

# exponentiation

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

28th Jun 2019, 8:34 PM
Yeabsira Yetagessu
+ 7
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 ðŸ˜Š
28th Jun 2019, 8:49 PM
aceisace
+ 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.
28th Jun 2019, 11:16 PM
Roxy
+ 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.
28th Jun 2019, 11:46 PM
Russ
+ 1
What does it mean ** in python ?
26th Jul 2019, 9:38 AM
Moses ben raghda
+ 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
26th Jul 2019, 9:51 AM
66:101:110:74:97:109:105:110
0
while using(/) then u get float value
25th Jul 2019, 8:47 AM
jessy polinati
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)
6th Aug 2019, 8:41 AM
Abdullah Ayman
0
If u don't want that float use this(//)
7th Aug 2019, 8:24 PM
Selva Kumar
0
x, x=4,7 y, y=x+7,x-7 Print(x, y) What is the output
4th Sep 2019, 7:14 AM
Poonam Singh
0
please tell me clearly what is the meaning ** or // in python, why we use double..... please explain it clearly
22nd Mar 2020, 1:06 PM
ashi
0
So I get mathematics, tho Exponentiation is grinding my gears.. like I don't get it..
23rd Mar 2021, 7:40 PM
chris
0