Python Forum
how do i create this program - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Homework (https://python-forum.io/forum-9.html)
+--- Thread: how do i create this program (/thread-13937.html)



how do i create this program - alexisyzr - Nov-07-2018

In many jurisdictions a small deposit is added to drink containers to encourage people to recycle them. In one particular jurisdiction, drink containers holding one liter or less have a $0.10 deposit, and drink containers holding more than one liter have a $0.25 deposit.

Write a program that reads the number of containers of each size from the user.
Your program should continue by computing and displaying the refund that will be received for returning those containers. Format the output so that it includes a dollar sign and always displays exactly two decimal places.


RE: how do i run this program - buran - Nov-07-2018

What have you tried? Show your code in python tags, full traceback in error tags, etc. We are glad to help, but we are not going to do your homework.


RE: how do i create this program - alexisyzr - Nov-07-2018

Well so far I've reached

less_deposit=0.10
more_deposit=0.25
less=float(input("Type a number of containers"))
more=float(input("Type a number of containers"))
refund=


RE: how do i create this program - buran - Nov-07-2018

That is a good start. Next is to calculate the refund you will get for both types of containers and print the sum.
Do you think it's possible to return partial container and get refund? hint: convert user input to int, not float
To print a formatted string as per requirements you will need to use string formatting. check the formatting mini-language