20 pts (TCOs 2.4, 5, and 8) Write a program to input a purchase amount and calcu
ID: 3741986 • Letter: 2
Question
20 pts (TCOs 2.4, 5, and 8) Write a program to input a purchase amount and calculate the sales tax and total due. The sales tax depends on the county identifying code. Counties with a number less than 8 have a 5% sales tax. The 8-20 codes have a sales tax of 6%. Codes above 20 have a sales tax of 7%. The purchase amount and county code are entered county code is between 5 and 30. Display the amount of the sales tax and the total. by the user. Use a loop to validate that the HTML Editor Paragraph 0 wordsExplanation / Answer
Code is written in python 3.x........
i=5
while i!=0:
total_sale_tax=0
total=0
j=0
li=[];
print("The Complete code is in Python 3.x")
b=int(input("Enter the No of Products:"))
print("Insert amount and code with space seperated between them. For eg: 25 7")
while j<b:
print('Insert '+str(j+1)+' amount and code: ',end='');
li.append(list(map(int,input().split())))
if int(li[j][1])<5 or int(li[j][1])>30:
a=input("Oppss!! Code should be in range 5-30. Do you want to continue the loop?(Y/N): ")
if 'Y'==a or 'y'==a:
j-=1;
li.pop()
else:
i=input("Do u want to make other calculation? Press '0' for 'NO' and '1' for 'YES':")
break;
else:
if li[j][1]<8:
li[j].append(li[j][0]*.05);
elif li[j][1]<20:
li[j].append(li[j][0]*.06);
else:
li[j].append(li[j][0]*.07);
total_sale_tax+=li[j][2];
total+=li[j][0]+li[j][2];
j+=1;
for w in li:
print('amount:'+str(w[0])+' code:'+str(w[1])+' sale_tax:'+str(w[2]));
print("Total Sale_tax= "+str(total_sale_tax));
print("Total(amount+sale_tax)= "+str(total));
i=input("Do u want to make other calculation? Press '0' for 'NO' and '1' for 'YES':")
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.