Python Forum
how do i create this program
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how do i create this program
#1
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.
Reply
#2
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.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
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=
Reply
#4
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
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Create a program that draws a box KaioKen 6 3,774 Feb-28-2018, 02:45 AM
Last Post: KaioKen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020