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
marin [14]
3 years ago
14

Write a program in python that can compare the unit (perlb) cost of sugar sold in packages with different weights and prices. Th

e program prompts the user to enter the weight and price of package 1, then does the same for package 2, and displays the results to indicate sugar in which package has a better price. It is assumed that the weight of all packages is measured in lb. The program should check to be sure that both the inputs of weight and price are both positive values.
Computers and Technology
1 answer:
Dmitrij [34]3 years ago
8 0

Answer:

weight1 = float(input("Enter the weight of first package: "))

price1 = float(input("Enter the price of first package: "))

weight2 = float(input("Enter the weight of second package: "))

price2 = float(input("Enter the price of second package: "))

if weight1 > 0 and price1 > 0 and weight2 > 0 and price2 > 0:

   unit_cost1 = price1 / weight1

   unit_cost2 = price2 / weight2

   

   if unit_cost1 < unit_cost2:

       print("Package 1 has a better price.")

   else:

       print("Package 2 has a better price.")

else:

   print("All the entered values must be positive!")

Explanation:

*The code is in Python.

Ask the user to enter the weight and the price of the packages

Check if the all the values are greater than 0. If they are, calculate the unit price of the packages, divide the prices by weights. Then, compare the unit prices. The package with a smaller unit price has a better price.

If all the entered values are not greater than 0, print a warning message

You might be interested in
II. MULTIPLE CHOICE (five points each)
seraphim [82]
Jsjajxhuwjakzjwidhwbjrjsbd
6 0
3 years ago
5. What would the browser display if the following code were executed in a script?a var product = 0; while ( product &lt;= 25 );
irga5000 [103]

Answer:

An infinite-loop

Explanation:

This is because the condition is always true ie: product is always less than 25. And once there is no sentinel to stop the loop it will run forever.

7 0
3 years ago
Identify the tools on the boxes. write the answer
Gnom [1K]

Answer:

im going off of what i know =( 2 screw driver 3 zip ties 5 needle nose plyers 8 can air

Explanation:

5 0
3 years ago
Voip uses ________ technology similar to email to transmit voice over the internet.
azamat
Voice Over Internet Protocol
7 0
3 years ago
Discuss the major procedures that investigators must use in order to collect network trace evidence of computer-related crimes.
frez [133]

Answer:

The answer is below

Explanation:

The major procedures that investigators must use to collect network trace evidence of computer-related crimes include the following:

1. Establish appropriate guidelines to follow: before starting the actual investigation, all the legal procedures and instructions to follow must be clearly stated and shown to everybody involved in the investigation process.

2. Assess the Evidence: the investigators must assess all the available evidence by checking the computer through a specific means. The assessment includes checking of hard drives, email accounts, social networking sites, or similar digital prints that can be used as proof of the criminal activities

3. Acquire the Evidence: here the investigators must find an appropriate means of gathering the evidence formally and legally. This may involve the removal of any form of hardware such as hard drives, and software-related items that can be extracted.

4. Examine the Evidence: this involved examination of the acquired evidence, to determine if it can be used as proof or not. This involved analyzing the evidence to check if they correlate with the criminal activities under investigation. Some of the things to check include, date of formation of the evidence, the names attached to it, the routes those data were sent or received from, etc.

5. Prepare a report and document them appropriately: this involved the proper detailing and recording of the information derived from the evidence. It includes the time of evidence examination and methods used in examining them. Also, the means at which they acquired the evidence among others.

8 0
3 years ago
Other questions:
  • Shirley was unsure about what career to go into. Her high school counselor suggested a personal assessment to point out Shirley’
    12·2 answers
  • Which of the following which of the following is an advantage of using functions ​
    14·1 answer
  • What are radio waves and what kinds of Information do they transmit ​
    12·1 answer
  • What is the magnitude of the largest positive value you can place in a bool? a char? an int? a float? a double??
    8·1 answer
  • When communicating with a server on another subnet, which of the following settings is used to determine which direction it need
    6·1 answer
  • Please Help!!!<br> I keep getting this answer wrong
    10·1 answer
  • What option from the format tab should you use to remove unwanted parts of a picture
    8·1 answer
  • Which is an example of synchronous communication? e-mail voicemail text message telephone conversation
    11·2 answers
  • C++Assign to maxSum the max of (numA, numB) PLUS the max of (numY, numZ). Use just one statement. Hint: Call FindMax() twice in
    8·1 answer
  • In your opinion., which Zelda character is the hottest? Be honest.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!