Discussion:
[Tutor] Python 3.5 Question
Sasuke Uchiha
2015-10-09 00:13:44 UTC
Permalink
Hi, I would like to know how to create a code similar to the result below.
I want to input a number like 1000, and for it to give me the maximum
output with the least amount of bills (such as 100s)

-

The bill amounts you have are 100s, 50s, 20s, 10s, 5s, and 1s
-
Please enter the amount of money you wish to withdraw: 1737 You received:
17 hundreds.
0 fifties.
1 twenties.
1 tens.
1 fives.
2 ones.
Please enter the amount of money you wish to withdraw: 168 You received:
1 hundreds.
1 fifties.
0 twenties.
1 tens.
1 fives.
3 ones.
_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
Ben Finney
2015-10-09 09:23:05 UTC
Permalink
Post by Sasuke Uchiha
Hi, I would like to know how to create a code similar to the result below.
Is this an assignment for you? We aren't a service to do homework.

Can you show some code you have written to try solving the problem? We
can discuss what you have already tried.

You may also be interested in the Python Tutor forum
<URL:https://mail.python.org/mailman/listinfo/tutor> which is specially
focussed on collaboratively teaching Python beginners.
--
\ “When I was born I was so surprised I couldn't talk for a year |
`\ and a half.” —Gracie Allen |
_o__) |
Ben Finney

_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription opt
Ben Finney
2015-10-09 15:47:37 UTC
Permalink
Post by Ben Finney
You may also be interested in the Python Tutor forum
<URL:https://mail.python.org/mailman/listinfo/tutor> which is specially
focussed on collaboratively teaching Python beginners.
Whoops, my apology! I failed to notice we are already in that forum :-)
--
\ “He may look like an idiot and talk like an idiot but don't let |
`\ that fool you. He really is an idiot.” —Groucho Marx |
_o__) |
Ben Finney

_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
htt
Mark Lawrence
2015-10-09 23:22:40 UTC
Permalink
Post by Ben Finney
Post by Ben Finney
You may also be interested in the Python Tutor forum
<URL:https://mail.python.org/mailman/listinfo/tutor> which is specially
focussed on collaboratively teaching Python beginners.
Whoops, my apology! I failed to notice we are already in that forum :-)
I simply had to roar with laughter at the signature you used for the
above as it just seemed so apt, nothing personal :)

<quote>
\ “He may look like an idiot and talk like an idiot but don't let |
`\ that fool you. He really is an idiot.” —Groucho Marx |
_o__) |
Ben Finney
</quote>
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/li
Ben Finney
2015-10-10 01:10:29 UTC
Permalink
Post by Mark Lawrence
Post by Ben Finney
Whoops, my apology! I failed to notice we are already in that forum :-)
I simply had to roar with laughter at the signature you used for the
above as it just seemed so apt, nothing personal :)
<quote>
\ “He may look like an idiot and talk like an idiot but don't let |
`\ that fool you. He really is an idiot.” —Groucho Marx |
_o__) |
Ben Finney
</quote>
Yes. Good sigmonster, have a cookie!

I don't pick the aphorisms, but I do get to see them before sending the
message. I found it totally apt also :-)
--
\ Fry: “Take that, poor people!” Leela: “But Fry, you’re not |
`\ rich.” Fry: “No, but I will be someday, and then people like |
_o__) me better watch out!” —Futurama |
Ben Finney

_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/
Alan Gauld
2015-10-09 09:26:52 UTC
Permalink
Post by Sasuke Uchiha
Hi, I would like to know how to create a code similar to the result below.
I want to input a number like 1000, and for it to give me the maximum
output with the least amount of bills (such as 100s)
This looks like homework and we won't do your homework for you.
But we can offer hints. It will help if you show us any
code you have written or even tell us how you think it might
work.

Meantime, look into the integer division and modulo operators.
They can be combined via the divmod() function which returns
both the division result and remainder in a single operation
like this:

hundreds,dollars = divmod(1737,100)

and hundreds will equal 17 and dollars 37.

hopefully you can see how that can be applied to your problem.
If not come back and ask more.
Post by Sasuke Uchiha
17 hundreds.
0 fifties.
1 twenties.
1 tens.
1 fives.
2 ones.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
Peter Otten
2015-10-09 09:36:36 UTC
Permalink
Post by Sasuke Uchiha
Hi, I would like to know how to create a code similar to the result below.
I want to input a number like 1000, and for it to give me the maximum
output with the least amount of bills (such as 100s)
-
The bill amounts you have are 100s, 50s, 20s, 10s, 5s, and 1s
-
Please enter the amount of money you wish to withdraw: 1737 You
received: 17 hundreds.
0 fifties.
1 twenties.
1 tens.
1 fives.
2 ones.
We don't do your homework, but as this is a common task for students there
is a site that does enough handholding to get you started:

http://cs.smith.edu/dftwiki/index.php/CSC111_Lab_2_2014

If you run into problems and have a little code to show you made an effort
yourself we will help you solve them.

_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
Continue reading on narkive:
Loading...