Question

In: Computer Science

Calculating delivery charges in Python. Purchase total > $150 Yes Number of the items (N) N<=5...

Calculating delivery charges in Python.

Purchase total > $150

Yes

Number of the items (N)

N<=5

N>=6

Delivery day

Same Day

Next Day

Same Day

Next Day

Delivery charges ($)

8

N * 1.50

N * 2.50

N * 1.20

The user will enter the purchase total, the number of the items and delivery day for calculating the delivery cost. Once the cost has been calculated, the program should correctly display the delivery cost and total cost for the user.

For example, if a user enters “$200” as purchase total, “7” as the number of the items and “1” as delivery in the same day, the program should be able to display the delivery cost of “17.50" and the total cost of “$217.50” ($200 + $17.50 ) for the user.

This program must be built by using sequence programming (without using functions) in Pythoin

Solutions

Expert Solution

Program
pur_cost=int(input("Enter purchase total : "))
no_items=int(input("Enter the number of items:"))
day=int(input("Enter delivery day:"))
if no_items<=5:
if day>1:
del_cost=(no_items*1.5)
else:
del_cost=8
elif no_items>=6:
if day>1:
del_cost=(no_items*1.2)
else:
del_cost=(no_items*2.5)

tot_cost=pur_cost+del_cost

print("Delivery cost:",del_cost)

print("Total Cost:",tot_cost)

Output

Enter purchase total : 200
Enter the number of items:7
Enter delivery day:1
Delivery cost: 17.5
Total Cost: 217.5

Screenshot


Related Solutions

Calculating Delivery Cost Program in Python write a program in Python that will ask a user...
Calculating Delivery Cost Program in Python write a program in Python that will ask a user to enter the purchase total, the number of the items that need to be delivered and delivery day. Then the system displays the cost of delivery along with the total cost. Purchase total > $150 Yes Number of the items (N) N<=5 N>=6 Delivery day Same Day Next Day Same Day Next Day Delivery charges ($) 8 N * 1.50 N * 2.50 N...
5-year Survival Treatment No Yes Total Yes 4300 750 5050 No 7200 650 7850 Total 11500...
5-year Survival Treatment No Yes Total Yes 4300 750 5050 No 7200 650 7850 Total 11500 1400 12900 Q: is the treatment effective? (Calculate and show the chi-squared test p value in your answer.)
Smoking Status            Lung Cancer         No Lung Cancer Total            Yes  &n
Smoking Status            Lung Cancer         No Lung Cancer Total            Yes             100           300               400            No             500           500              1000 Calculate the risk of developing lung cancer among the exposed group Calculate the risk of developing lung cancer among the unexposed group Calculate the risk ratio of the exposed group when compared to the unexposed group Calculate the odds of developing lung cancer among the diseased group Calculate the odds of developing lung cancer among the non- diseased group Calculate the exposure odds ratio...
Using Python and Kivy to create a App to ask users 5 questions with Yes or...
Using Python and Kivy to create a App to ask users 5 questions with Yes or No button. 1. Are you older than 14? 2. Did you pass 8th or 9th Grade? 3. Are you ready gor highschool? 4. Do you have 4 more years to complete highschool? 5. Are you homeschool? If the users click Yes for 3 questions or more than you should get a results page saying this users is in highschool or else the user is...
This is a python question. Write a function mult_table(n) that consumes a natural number n and...
This is a python question. Write a function mult_table(n) that consumes a natural number n and returns the n+1 by n+1 multiplication table (where each entry in the inner list is equal to the product of which list it is and the inner list position number, or in other words, the product of the row and column numbers). Use accumulative recursion. def mult_table(n) ''' Returns the n+1 by n+1 multiplication table    mult_table: Nat => (listof (listof Nat))    Examples:...
Write a Python program tat asks the user for the number of equations (n) to be...
Write a Python program tat asks the user for the number of equations (n) to be solved and fill the coefficient matrix A and the right matrix b with random integers. Limit the values of the elements of A to numbers between 0 and 50 and elements of b to 0 and 500. Lastly, put the matrices into an Excel file.
Joe Birra needs to purchase malt for his microbrewery production. His supplier charges $37 per delivery...
Joe Birra needs to purchase malt for his microbrewery production. His supplier charges $37 per delivery (no matter how much is delivered) and $1.25 per gallon. Joe’s annual holding cost per unit is 35 percent of the price per gallon. Joe uses 250 gallons of malt per week. Assume 52 weeks per year. Round your answer to 3 digits after the decimal point. Do NOT use comma in your numeric answers. Suppose Joe orders 1000 gallons each time. His average...
programming in python Design a program that initializes a list of 5 items to zero (use...
programming in python Design a program that initializes a list of 5 items to zero (use repetition operator). It then updates that list with a series of 5 random numbers. The program should find and display the following data: -The lowest number in the list - Average of the numbers stored in the list
Python A program which prompts the user to enter an number which is a integer n...
Python A program which prompts the user to enter an number which is a integer n and creates a tuple where the values are all numbers between 1 and n (both inclusive). Note: you can assume that the integer will always be > 1. Input Result 3 Enter an integer: 3 (1, 2, 3)
Joe Birra needs to purchase malt for his micro-brew production. His supplier charges $40 per delivery...
Joe Birra needs to purchase malt for his micro-brew production. His supplier charges $40 per delivery (no matter how much is delivered) and $1.25 per gallon. Joe’s annual holding cost is 30% of the price per gallon. Joe uses 200 gallons of malt per week. a. Suppose Joe orders 125 gallons each time. What is his average inventory? gallons (Round your answer to 2 decimal places.) b. Suppose Joe orders 1000 gallons each time. How many orders does he place...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT