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

shiroo Group Title

what's the problem with this program? http://dpaste.com/911626/

  • one year ago
  • one year ago

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

    one quick hint: your outstandingbalance is created after the for loop...so it doesnt know how much that is till it finisces the for loop....(after 12 rounds) your implementation is all wrong i believe... u define your function (main) but u call it after the spot u actually need it..... try calling it before the for loop and see what happens...

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

    plus: in the end you are printing the word "RESULT" why?!

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

    I would recommend one or two blank lines to separate your function from your main code. That will give a much different perspective on what the program is really doing. During debugging, I frequently print the value of variables at different points to try to find the problem, and then take the print statements out when it starts running.

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

    hey here are some suggestions 1. you don`t actually need a main() function because what you are doing is taking i as an argument and returning it back besides taking some inputs so rather don`t use main() or do all your calculations in the main() itself. 2. as pointed out do separate your functions from the other code 3. just printing RESULT on the screen won`t do rather print in the more information that is required as an output 4. as a good programming practice try and name your functions that are easy to understand just by reading the name e.g you could name it balance() or card_balance something of this sort. 5. at this stage your best debugging tool is print statements. if you don`t get your answer try introducing print statements to check what you expected and what you got back from the machine.

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

    thank you all for the responses

    • 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.