Skip to main content

Program to input from the user, the market price per unit of purchased items and unit purchased

# Program to input from the user, the market price per unit of purchased items and unit purchased
# until the user asks to stop. Calculate the total price. Give discount of 5% if the total price
# is between 100 to 500, 10% if that between 500 to 1500,15% for that between 1500 to 3000 and 25%
# if the total price is above 3000.Output the total price to be paid.
z=input("Enter the no. of items:")
z=int(z)
c=0.0
if z>0:
 for n in range (1,z+1):
  y=input("Market price per unit of the item no."+str(n)+":")
  y=float(y)
  c=y+c
 print("Total amount=",c)
 if c>=100 and c<=500:
  d=c*(100-5)/100
 if c>=500 and c<=1500:
  d=c*(100-10)/100
 if c>=1500 and c<=3000:
  d=c*(100-15)/100
 if c>=3000:
  d=c*(100-25)/100
 print("The amount to be paid=",(round(d,2)))
 print("Paid.")
 print("Thank you, visit again.")
else :
 print("You have not purchased any item. Thank you, visit again.")

Comments