Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

thangeram

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 ?

  • one year ago
  • one year ago

  • This Question is Closed
  1. thangeram
    Best Response
    You've already chosen the best response.
    Medals 0

    in python ide

    • one year ago
  2. Chris2332
    Best Response
    You've already chosen the best response.
    Medals 1

    I was about to ask where!

    • one year ago
  3. Chris2332
    Best Response
    You've already chosen the best response.
    Medals 1

    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!

    • one year ago
  4. chb0openstudy
    Best Response
    You've already chosen the best response.
    Medals 1

    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/

    • one year ago
  5. thangeram
    Best Response
    You've already chosen the best response.
    Medals 0

    what is best for learners to use 2.7 or 3.0 ?

    • one year ago
  6. MicroBot
    Best Response
    You've already chosen the best response.
    Medals 1

    for learners i believe best is 2.7 (also said by the professors and the python.org site)

    • one year ago
  7. MicroBot
    Best Response
    You've already chosen the best response.
    Medals 1

    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

    • one year ago
  8. thangeram
    Best Response
    You've already chosen the best response.
    Medals 0

    thanx @chb0openstudy @MicroBot and @Chris2332 to all

    • one year ago
    • Attachments:

See more questions >>>

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.