Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Programming Issues

Reply
Thread Tools

Re: Programming Issues

 
 
Jason Friedman
Guest
Posts: n/a
 
      09-20-2012
> 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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows XP Pro clean install issues, SP2 issues too... Howie Computer Support 9 07-12-2005 04:47 PM
Windows XP Pro clean install issues, SP2 issues too... Howie Computer Support 0 07-06-2005 07:12 PM
Re: Windows XP Pro clean install issues, SP2 issues too... pcbutts1 Computer Support 0 07-06-2005 04:58 PM
Re: Windows XP Pro clean install issues, SP2 issues too... pcbutts1 Computer Support 0 07-06-2005 04:52 PM
SNMP Issues in Cisco Routers; Vulnerability Issues in TCP =?iso-8859-1?Q?Frisbee=AE?= MCSE 0 04-21-2004 03:00 PM



Advertisments