Re: Programming Issues

Discussion in 'Python' started by Jason Friedman, Sep 20, 2012.

  1. > Ask the user for the amount of change expressed in cents. Your program must
    > compute and display the number of half-dollars, quarters, dimes, nickels,
    > and pennies to be returned.
    > Return as many half-dollars as possible, then quarters, dimes, nickels, and
    > pennies, in that order.
    > Your program must allow the user to continue entering different amounts of
    > change until they enter 0 to indicate they are finished. If the user enters
    > a negative number, inform them of their mistake and ask them to enter a
    > correct value.


    Perhaps you can start with pseudo-code
    (http://en.wikipedia.org/wiki/Pseudo_code) and ask for help writing
    that in Python. I'll get you started.

    Ask for a number.
    If number = 0, stop.
    If number < 0, ask again.

    With values 50, 25, 10, 5 and 1:
    if number > value:
    coincount = integer portion of number divided by value
    print coincount, value
    remaining number = ...

    I've broken the pseudo-code into two parts because they are, in some
    sense, different programs.
    You might try to write one, then the other.
    In other words, starting by writing this in Python:

    Ask for a number.
    If number = 0, stop.
    If number < 0, ask again.
    If number > 0, print number and quit.
    Jason Friedman, Sep 20, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. john
    Replies:
    19
    Views:
    507
    John Ersatznom
    Jan 6, 2007
  2. Replies:
    6
    Views:
    101
    Dave Thomas
    Apr 29, 2007
  3. Ted Byers
    Replies:
    9
    Views:
    110
    Ron Bergin
    Dec 5, 2008
  4. Dave Angel

    Re: Fwd: Programming Issues

    Dave Angel, Sep 19, 2012, in forum: Python
    Replies:
    0
    Views:
    164
    Dave Angel
    Sep 19, 2012
  5. Dennis Lee Bieber

    Re: Fwd: Programming Issues

    Dennis Lee Bieber, Sep 19, 2012, in forum: Python
    Replies:
    0
    Views:
    171
    Dennis Lee Bieber
    Sep 19, 2012
Loading...

Share This Page