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

jessejayne Group Title

I am learning Python and I need some help.

  • 2 years ago
  • 2 years ago

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

    I am taking an opencourseware to learn my first programing language, python. This is what I am trying to do: Now write a program that calculates the minimum fixed monthly payment needed in order pay off a credit card balance within 12 months. We will not be dealing with a minimum monthly payment rate. Take as raw_input() the following floating point numbers: 1. the outstanding balance on the credit card 2. annual interest rate as a decimal Print out the fixed minimum monthly payment, number of months (at most 12 and possibly less than 12) it takes to pay off the debt, and the balance (likely to be a negative number). Assume that the interest is compounded monthly according to the balance at the start of the month (before the payment for that month is made). The monthly payment must be a multiple of $10 and is the same for all months. Notice that it is possible for the balance to become negative using this payment scheme. Here is my code: http://dpaste.com/hold/785090/ Can someone please help me figure out what I am doing wrong?

    • 2 years ago
  2. No-data Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    I can help you, but right now I'm very tired and unable to think decently. I hope someone comes to help you if you're in a hurry. Anyway I could help you tomorrow morning after a great breakfast and a delicious coffe. Have a good night!

    • 2 years ago
  3. No-data Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    By the way, I'm don't program using Phyton but I think I could help you with the algorithm.

    • 2 years ago
  4. jessejayne Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    It's not for a "class" so I have plenty of time. Just something that is driving me crazy :P

    • 2 years ago
  5. jessejayne Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    ok so I have now have this. hooray the program runs, but alas the answers aren't correct. http://dpaste.com/hold/785102/

    • 2 years ago
  6. rsmith6559 Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    First, don't be afraid of variable names up to 31 characters long, AFAIK, all modern languages will accept them. A variable name like outstandingBalance will help document what you're doing (You won't have to write as many comments). Second, in a number of places, you're doing type conversions for no reason that I can see. As a very general rule, you only need to do type conversions for input and occasionally for output. The print (technically it's a function, and Python3 uses that syntax) function can handle different data types correctly. To me, it looks like you're using a trial and error approach. You're running different payments in the for loop. You're changing the value of ub in the for loop, and not resetting it after the test in the while statement.

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