+ 1

is the dividing and float thing different in 2.7.10?

because when im in the Python 2.7.10 Shell and i use (4+8)/3 i dont get a float answer i get 6

5th Jul 2016, 2:21 AM
Eren Kalliope
Eren Kalliope - avatar
5 ответов
+ 2
in python 2.7 u don't need to put print(7) u can directly do print 7 7/2=3 4/3=1 4.0/3=1.33 4/3.0=1.33 4.0/3.0=1.33 also this is //floor division gives integer python3.3 4/3 1.33 4//3=1 // is floor division
6th Jul 2016, 6:02 PM
Vansh Batra
Vansh Batra - avatar
+ 1
well yes. use (4+6)/5.0 to get 2.0 in 2.7.3.
6th Jul 2016, 5:04 PM
Ashish Jha
Ashish Jha - avatar
0
"/" using this operator for the expression above u will get the quotient as the answer, It will be 4.! 6
5th Jul 2016, 4:57 AM
Sudi Iyengar
Sudi Iyengar - avatar
0
what does 4.! 6 mean?
5th Jul 2016, 5:53 AM
Eren Kalliope
Eren Kalliope - avatar
0
and i thought this tutorial just literally said (4+8)/3 is 6.0
5th Jul 2016, 5:54 AM
Eren Kalliope
Eren Kalliope - avatar