why there is difference between 2.7 and 3.1 when i type line x=6/2 2.7 gives ans 3 and 3.1 gives us 3.0 ?

At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get our expert's

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions.

A community for students.

why there is difference between 2.7 and 3.1 when i type line x=6/2 2.7 gives ans 3 and 3.1 gives us 3.0 ?

MIT 6.189 A Gentle Introduction to Programming Using Python (OCW)
See more answers at brainly.com
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions

in python ide
I was about to ask where!
In Python 3.0 and above using the / operator for division will result in a floating point division rather than an integer division. That's why you see a 3.0 result when using Python 3.1. Hope that helps!

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

From a pure computer science perspective this actually deals with the limitations of doing division on binary computers. Each language must arbitrarily decide how to manage Integer division that would produce a remainder. It may truncate, it may round up. It doesn't matter it just needs to be known. If fractions matter then floating point numbers will be better but even they can't represent certain divisions properly. See: http://www.nr.com/
what is best for learners to use 2.7 or 3.0 ?
for learners i believe best is 2.7 (also said by the professors and the python.org site)
From the free online book version u can find ur answer: http://www.greenteapress.com/thinkpython/html/thinkpython003.html#toc15 2.4 Operators and operands

Not the answer you are looking for?

Search for more explanations.

Ask your own question