Python Forum

Full Version: how do i create this program
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
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.
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=
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