#lab 7 assignment with functions def main(): #input price1=float(input("enter price of first item ")) cat1=int(input("category for 1 item ")) price2=float(input("enter price of second item ")) cat2=int(input("category for 2 item ")) price3=float(input("enter price of third item ")) cat3=int(input("category for 3 item ")) tax=int(input("enter tax ")) validity1=valid_input(price1, cat1) validity2=valid_input(price2,cat2) validity3=valid_input(price3, cat3) if(validity1 and validity2 and validity3): cost1=item_cost(price1, cat1, tax) cost2=item_cost(price2, cat2, tax) cost3=item_cost(price3, cat3, tax) total_cost=total(cost1, cost2, cost3) if(total_cost>=40): print("final price", total_cost-10) else: print("final price", total_cost) else: print("NO VALID INPUT") def item_cost(price, category, tax): if(category==1): discount=10/100 elif(category==2): discount=15/100 else: discount=30/100 cost=(price-price*discount)*(1+tax/100) return cost def total(item1, item2, item3): return(item1+item2+item3) def valid_input(price, category): cond1=(price>=0) cond2=(category==1) or (category==2)or (category==3) if(cond1 and cond2): return True else: return False main()