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

Python

3235 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?

top 2 comments
sorted by: hot top controversial new old
[โ€“] [email protected] 1 points 1 year ago

What kind of program do you use to code/run the python script in?

[โ€“] [email protected] 1 points 1 year ago

This may be so hopelessly late as to be useless, but it could be that you're using Python version 2.2 to 2.7 where the division operation on integers is different

This StackOverflow link explains it a bit more, https://stackoverflow.com/questions/183853/what-is-the-difference-between-and-when-used-for-division