dict_product = {'褲子':600, ...}
dict_cart    = {'褲子':0, '衣服':0, ...}
# 注意,簡單範例只假設輸入一次買一件,並且沒有防呆機制
while True:
    product = input('請輸入你要購買的產品名稱, 或輸入 q 結束購買')
    
    # 離開迴圈結束購買
    if product == 'q':
        break 
        
    # 購物車 +1
    dict_cart[product] += 1 
# dict_product 與 dict_cart 進行mapping
# 存放總價
total = 0 
# 取出產品來匹配
for i in dict_product.keys():
    # 針對特價做例外處理
    if i == '衣服' and dict_cart[i]>=3:
        sub_total = 0 # 例外計算的總價
        quo = dict_cart[i]//3 # 商數
        rem = dict_cart[i]%3  # 餘數
   
        # 取商數以打折計算
        sub_total += dict_product[i] * quo *3 *0.9
        # 取餘數以原價計算
        sub_total += dict_product[i] * rem
        
        # 最後加總
        total += sub_total
        
        # 跳至迴圈下一步(會跳過一般計算金額,避免重複加總)
        continue
        
    # 一般計算金額
    total += dict_product[i] * dict_cart[i]
以上只是簡易實現,沒有考量到效能或其他控制功能,僅供參考
參考用
product = {"clothes": 600, "pants": 500, "skirts": 700}
total = []
for product, price in product.items():
    amount = int(input(f"請輸入 {product} 購買數量: "))
    
    if product == "clothes" and amount >= 3:
        total.append(price * amount * 0.9)
    else:
        total.append(price * amount)
print(f"一共消費 {sum(total)} 元")
可以設定X為買clothes的數量, Y為價格
if X>=3:
Y=X x 600 x 0.9
以這樣去算。