1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Romashka [77]
3 years ago
7

2. In many jurisdictions a small deposit is added to containers to encourage people to recycle them. In one particular jurisdict

ion, containers holding one litre or less have a $0.10 deposit, and containers holding more than one litre have a $0.25 deposit. Write a Python script that reads the number of containers of each size from the user. The script should compute and display the refund that will be received for returning those containers. Format the output so that it includes a dollar sign and displays exactly two decimal places.

Computers and Technology
1 answer:
RUDIKE [14]3 years ago
5 0

Answer:

Here is the Python program:

small_container = int(input("Enter the number of small containers you recycled?"))

large_container = int(input("Enter the number of large containers you recycled?"))

refund = (small_container * 0.10) + (large_container * 0.25)

print("The total refund for returning the containers is $" + "{0:.2f}".format(float(refund)))

Explanation:

The program first prompts the user to enter the number of small containers. The input value is stored in an integer type variable small_container. The input is basically an integer value.

The program then prompts the user to enter the number of large containers. The input value is stored in an integer type variable large_container. The input is basically an integer value.

refund = (small_container * 0.10) + (large_container * 0.25)  This statement computers the refund that will be recieved for returning the small and larger containers. The small containers holding one litre or less have a $0.10 deposit so the number of small containers is multiplied by 0.10. The large containers holding more than one litre have a $0.25 deposit so the number of large containers is multiplied by 0.25. Now both of these calculated deposits of containers of each side are added to return the refund that will be received for returning these containers. This whole computation is stored in refund variable.

print("The total refund for returning the containers is $" + "{0:.2f}".format(float(refund))) This print statement displays the refund in the format given in the question. The output includes a $ sign and displays exactly two decimal places by using {0:.2f} where .2f means 2 decimal places after the decimal point. Then the output is represented in floating point number using. format(float) is used to specify the output type as float to display a floating point refund value up to 2 decimal places.

You might be interested in
Write a program that lets the user enter the name of a team and then displays the number of times that team has won the World Se
xz_007 [3.2K]

Answer:

see explaination

Explanation:

import java.io.*;

import java.util.Scanner;

public class Winners {

public static void main(String args[]) throws IOException {

Scanner sc = new Scanner(new File("WorldSeriesWinners.txt"));

String commands[] = new String[100000];

int c = 0;

while (sc.hasNextLine()) {

String input = sc.nextLine();

System.out.println(input);

if (input.isEmpty())

continue;

commands[c++] = input;

}

sc.close();

Scanner keyboard = new Scanner(System.in);

System.out.println("Enter the name of a team: ");

String name = keyboard.nextLine();

int count = 0;

for (int i = 0; i < c; i++) {

if (commands[i] != null) {

if (commands[i].equals(name)) {

++count;

}

}

}

if(count!=0)

System.out.println(name + " has won the World Series in the time period from 1903 through 2018 " +count + " number of times" );

else

System.out.println("Team with name "+name+ " does not exists");

}

}

5 0
3 years ago
What are the uses of computer in educational setting?
Arada [10]

Answer:

Quick Communication & Correspondence

Explanation:

Another main advantage of using computers in the education field is the improvement in the quality of teaching-learning process and communication between students & teachers. For this, they use Microsoft PowerPoint to prepare electronic presentations about their lectures.

8 0
3 years ago
Read 2 more answers
Which is the best information to determine an athlete's abilities and needed areas of improvement?
katen-ka-za [31]

Answer:

4

Explanation:

7 0
2 years ago
Read 2 more answers
The period of time during which an IDPS monitors network traffic to observe what constitutes normal network behavior is referred
horrorfan [7]

Answer: Training period

Explanation:

The training period is refers to the period of time where we can monitor all the network traffic and also observe all the networking behavior with the constitute.

  • During the training period we get a proper training about the specific topic and also get a chance to learn various types of things.

 According to the given question, in the training period an IDPS monitor is used observing the networking traffic and the network behavior. Therefore, raining period is the correct answer.

 Therefore, Training period is the correct answer.

5 0
3 years ago
1 : What format would you apply to give an entry the appearance of 12-Mar-2014
Arturiano [62]

Answer:

1. Date 2. It will appear to the right of the selected column.

4 0
3 years ago
Other questions:
  • As you are researching RAM for a computer you are building that will be used as a home office server for his small business. The
    5·2 answers
  • Modern database tools support ________________, which entails separating data from the programs that manipulate data.
    14·1 answer
  • Peter has recently bought a media player and a digital camera. He wants to buy a memory card for these devices. Which memory dev
    12·2 answers
  • How can I use the internet/social media to protect my identity?
    14·1 answer
  • Write a program to add two number marie simulator.
    15·1 answer
  • Word can store a maximum of how many documents in its Recent Documents area? five ten fifteen twenty
    8·1 answer
  • Fill in the blank with the letter HTML
    14·1 answer
  • If, when asked for a date of birth, the user enters a future date, this error should be caught by a ________ check.
    8·1 answer
  • Write a short note on Computer<br>impact on<br> our society?​
    7·2 answers
  • How does the autosum command calculate data? Need help ASAP​
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!