this post was submitted on 14 Apr 2021
1 points (100.0% liked)

Python

3275 readers
1 users here now

News and discussions about the programming language Python


founded 5 years ago
MODERATORS
 

I've started to learn programming Python (also i'm a beginner) and my code's print result was "0". Could someone explain why?

I mean, on my calculator hardware it results on something like "0.5555552", this has anything to do with the Python Interpreter's code?

you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 0 points 3 years ago* (last edited 3 years ago) (1 children)

First: Thank you very much for explaining it, i haven't knew that kind of division on Python (as if i'm a newbie on programming at all uhhh)

Second: Now that you've mentioned it, i'm using Geany so probably it is running python2, because after running my code from Python3, it printed what i was expecting. I thought Geany was running Python3 as it is already installed on my system, both Python 2 and 3 came pre-installed, but running Python 2 was really unexpected.

[โ€“] [email protected] 1 points 3 years ago* (last edited 3 years ago)

It may be that Geany calls for python and that defaults to python2 instead of python3 command, but I would be surprised if your OS still defaulted to Python 2. Glad you figured it out. Have fun learning Python :)