Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Help! I need a \"PYTHON\" program, step by step for this one. Write a program th

ID: 663044 • Letter: H

Question


Help! I need a "PYTHON" program, step by step for this one.

Write a program that asks the user to enter the weight of a package and then displays the shipping charges according to the following rates: Weight of Package 2 pounds or less Over 2 pounds but not more than 6 pounds Over 6 pounds but not more than 10 pounds Over 10 pounds but not more than 30 pounds Over 30 pounds Shipping Charge Flat fee: $3.00 $1.80 per pound $1.70 per pound $1.60 per pound Flat fee: $50.00 If the weight enter is outside the range of (0, 50], the program should displays an error message. SAMPLE RUN #1 Enter the weight of the package: o Invalid weight SAMPLE RUN #4 Enter the weight of the package: 10.1 Shipping charge: $ 16.16 SAMPLE RUN #2 Enter the weight of the package: 1.5 Shipping charge: $ 3.00 SAMPLE RUN #5 Enter the weight of the package: 45 Shipping charge: 50.00 SAMPLE RUN #3 Enter the weight of the package: 10-0 Shipping charge: $17.00 SAMPLE RUN #6 Enter the weight of the package: 55 Invalid weight

Explanation / Answer

flatfee=3
totalfee=0
s=float(raw_input("Enter the Weight of the Package:"))
if s<=0 or s>50:
print "Invalid Weight"

else:
if s<=2:
totalfee=flatfee
elif s<=6:
totalfee=s*1.80
elif s<=10:
totalfee=s*1.70
elif s<=30:
totalfee=s*1.60
else:
totalfee=50
if totalfee!=0:
print "ShippingCharge:$%s"%str(totalfee)
  

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote