Question

"please help asap" Create a function called GetTotal that will take in to it the price...

"please help asap" Create a function called GetTotal that will take in to it the price per pound of an item and how much an item weighs. This weight is in pounds and ounces. Make sure when you write your function that your define your parameters in the right order (price, pounds, ounces). Your function needs to return the total cost of the item. You will need the following formula:

Total Price = Price per pound * (Pounds + ounces/16)

Because this problem needs to return a value representing currency or money, we need to round the total price to 2 decimal places. To do this will need to use the round function. In Python the syntax would be:

your_variable = round(your_variable, # of spaces)

your_variable = 323.47956
your_variable = round(your_variable, 2)
print(your_variable)

This would print:

323.48

Given that an item costs 6.99 per pound and weighs 3 pounds, 2 ounces, the total price would be 21.84.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#function for calculaing Total price
def GetTotal(price, pounds, ounces):
   Total_Price = price*(pounds + ounces/16)
   return Total_Price

#reading values from user
price=float(input("Enter item costs per pound : "))
pounds=float(input("Enter pounds : "))
ounces=float(input("Enter ounces: "))
#storing function return value in to Total
Total=GetTotal(price, pounds, ounces)
#displaying Total price
print("Total Price : ",round(Total,2))

Add a comment
Know the answer?
Add Answer to:
"please help asap" Create a function called GetTotal that will take in to it the price...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Must be flowchart in a raptor program: The manager of a Super Supermarket would like to...

    Must be flowchart in a raptor program: The manager of a Super Supermarket would like to be able to compute the unit price for products sold there. To do this, the program should input the name and price of an item per pound and its weight in pounds and ounces. Then it should determine and display the unit price (the price per ounce) of that item and the total cost of the amount purchased. You will need the following variables:...

  • using raptor Using the Prelude to Programming book, complete Programming Challenge 2 on page 177. Save...

    using raptor Using the Prelude to Programming book, complete Programming Challenge 2 on page 177. Save your file as LASTNAME_FIRSTNAME_M03HW2. (worth 10 points) The manager of the Super Supermarket would like to be able to compute the unit price for products sold there. To do this, the program should input the name and price of an item per pound and its weight in pounds and ounces. Then it should determine and display the unit price (the price per ounce) of...

  • Python Language need help asap Exercise: create01 Description Write a function that receives no parameters and...

    Python Language need help asap Exercise: create01 Description Write a function that receives no parameters and returns a Pencil object constructed with 3 leads. Function Name create01 Parameters • None Return Value A Pencil object with 3 leads. Example р create01() print(p.get_num_leads()) # -> 3 print(p.get_current_lead_length()) # > 10 Hints • Don't forget to import Pencil.

  • please answer this ASAP Help Seve Eh Submh The selling price of a baseball bat is...

    please answer this ASAP Help Seve Eh Submh The selling price of a baseball bat is $15, fed cost per month is $4,800, and variable cost per bat is $9. The total revenue per month needed to break even is $ Do not include the $sign, spaces or commas in your answer. Fill in the blank

  • PYTHON FILL IN THE BLANK CODE REMEMBER TO UTILIZE DICTIONARIES # Implement this function: def store_checkout(inventory_tuple_list,...

    PYTHON FILL IN THE BLANK CODE REMEMBER TO UTILIZE DICTIONARIES # Implement this function: def store_checkout(inventory_tuple_list, item_purchase_list): """ inventory_tuple_list: A list of tuples. Each tuple has a string representing an item name, an int representing a price, and a string representing a description. Example: [("A", 5, "shiny new A"), ("B", 10, "big heavy B")] item_purchase_list: A list of strings. Each string represents an item name. Example: ["A", "A", "B", "C"] Return the total price of the items in item_purchase_list by...

  • Please help! CS Problem Set 5 #Write a function called sphere_data. volume_and_area will #take in a...

    Please help! CS Problem Set 5 #Write a function called sphere_data. volume_and_area will #take in a dictionary. This dictionary is guaranteed to #have exactly one key: "radius", whose value is an integer #representing the radius of a sphere. # #Modify this dictionary to add two keys: "volume" and "area". #The values associated with these keys should be the volume #and surface area of the sphere. # #The formula for volume is: # (4/3) * pi * radius ^ 3 #...

  • In Python. #1. please write a function called "stocksell", #2. the input parameters are the price...

    In Python. #1. please write a function called "stocksell", #2. the input parameters are the price list (l) and the ith day,i from [0, 7], #3. the return value is the jth day you should sell to make the most profit, #4. print the profit #for example a = stocksell(l, 2) then a = 6 #(2nd day price is 32, selling day is 6th day, price is 35) l = [34,47,32, 28, 29, 31, 35,34]

  • help asap in python codio, A good friend of yours owns a small company that produces...

    help asap in python codio, A good friend of yours owns a small company that produces a tool the helps disabled individuals open jars and containers. Rather than buy a time clock mechanism, he would like to put an old computer on the warehouse floor that could be used as the time clock and help them manage materials, shipments, etc. Your friend was able to find an inexpensive application to keep track of each employee’s hours. However, this application did...

  • I need help asap, Python language 2) Write a class to represent a class to represent...

    I need help asap, Python language 2) Write a class to represent a class to represent a Car and its passengers. Write a constructor that takes one additional parameter a number, the total seats in the car. The constructor should save this as a datamember and also initialize an additional datamember, a list, to keep track of the passengers in the car. Write method addRider that takes an additional parameter a string of the passenger to be added to the...

  • FOR C++ PLEASE Create a class called "box" that has the following attributes (variables): length, width,...

    FOR C++ PLEASE Create a class called "box" that has the following attributes (variables): length, width, height (in inches), weight (in pounds), address (1 line), city, state, zip code. These variables must be private. Create setter and getter functions for each of these variables. Also create two constructors for the box class, one default constructor that takes no parameters and sets everything to default values, and one which takes parameters for all of the above. Create a calcShippingPrice function that...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT