My program gives me 6 instead of 6.0 when I execute 12/2? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

My program gives me 6 instead of 6.0 when I execute 12/2?

8th Jan 2017, 9:33 PM
Emenike
7 Respostas
+ 4
then you have Python 2. Please use Python 3 instead.
8th Jan 2017, 9:44 PM
Amaras A
Amaras A - avatar
+ 3
2.7 is very good as well as 3.x... because still a lot of Python 2.x are running in production. And as 3.x is a major changement version, stability and ecosystem compatibiity ( not all libraries/module have yet been ported in 3.x ) is still in favour of 2.x ^^ So learning/knowing 2.7 is a good idea, and learning the few differences or how to upgrade 2.7 behaviour to 3.x one is so easy :P
9th Jan 2017, 6:27 AM
visph
visph - avatar
+ 2
you can try: 12.0/6 or float(12)/6
8th Jan 2017, 10:15 PM
DFX
DFX - avatar
0
16//2 try that code. the double division bar
9th Jan 2017, 12:02 AM
Nahuel
Nahuel - avatar
0
@Nahuel you should try to read the questions before answering. also stop upvoting your own wrong answers. *facepalm*
9th Jan 2017, 12:09 AM
DFX
DFX - avatar
0
Thank you guys I just uninstalled the 2 7 I got I installed 3.5 and problem solved
9th Jan 2017, 6:15 AM
Emenike