Quantcast

A community for students. Sign up today!

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

southpaw118

  • one year ago

I'm using Linux Mint 14 (Nadia) and Python 2.7.3. I can't get that 'Cube Root of a Perfect Cube" program working. It prompts me to enter an integer and when I do and hit enter, I go right back to the prompt. Anyone else with this problem?

  • This Question is Closed
  1. e.mccormick
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Did you try tossing in some print statments?

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

    yes e.mccormick is right , to print something on screen you need to insert print statements in your code Going back to the prompt without error means that program executed properly(even tough in this case did not gave the desired result i.e to print the answer)

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

    Thanks a lot. Let me give that a try.

  4. e.mccormick
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Many programmers will make some sort of console dump or printout to debug things. There are tons of debugging tools, but the basic "print this variable at this instant" method has a serious advantage: It is very easy to do and does not rely on you managing to get the program to stop at just the right moment. I have had a loop print "in loop" at the top just to make sure it was actually looping... found out it was going in, but not looping, traced down the logic error, ran again and got tons of "in loop" messages so I knew that was fixed. Little things like that can be invaluable! So even if you don't print a variable, printing a message would let you know that Python was working.

  5. seandisanti
    • 7 months ago
    Best Response
    You've already chosen the best response.
    Medals 0

    and also, as Prof Guttag points out in his lecture on debugging, don't just output value for debugging purposes. When you're able (which you should always be) add more to the output to provide context. specifically what variable you're outputting and what you expect it to be. That will make discrepancies jump out at you even more and can save you from your own subliminal assumptions which can take hours to track down in complicated algorithms

  6. seandisanti
    • 7 months ago
    Best Response
    You've already chosen the best response.
    Medals 0

    and apparently this is an old thread, sorry for the accidental bump

  7. seandisanti
    • 7 months ago
    Best Response
    You've already chosen the best response.
    Medals 0

    and that one

  8. seandisanti
    • 7 months ago
    Best Response
    You've already chosen the best response.
    Medals 0

    bah, i give up. back to work

  9. e.mccormick
    • 7 months ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Might as well close it. It is 7 months old. Hehe

  10. abtster
    • 2 months ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Still a good advice, seandisanti

  11. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Ask a Question
Find more explanations on OpenStudy

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.