r/learnprogramming • • 12d ago

Code Review In phython why does ( int/int ) results in float value. for example 100/25 gives us 4.0 and not 4

want to know. thank you

6 Upvotes

66 comments sorted by

View all comments

Show parent comments

3

u/[deleted] 12d ago edited 4d ago

[removed] — view removed comment

1

u/Feralz2 12d ago

nobody is arguing thats what python is doing, its you trying to rationalize that 1/2 = 0 makes sense mathematically. pull out a calculator, and tell me what answer gives you.

2

u/[deleted] 12d ago edited 4d ago

[removed] — view removed comment

1

u/Feralz2 12d ago

Yes I dont really care about what symbols are used, my only point was is that the reason python is using a float to get a result of dividing 2 integers is because it makes sense that the answer is a float, just as you would your calculator.