我正在學習python的學校練習,如果他們的購買價格在10美元到20美元之間,我要求給予客戶20%的折扣。然後在21美元至30美元之間購買30%的折扣。每當我輸入一個21到30之間的數字時,它會給我20%和30%的折扣,我怎麼讓它給我只有30%的折扣。此外pyscrpiter說unorderable類型在第2行如何解決此錯誤建議if語句和使用輸入
productprice=input ('Enter price of product')
if productprice > 10:
discount = productprice*0.80
if productprice> 20:
discount = productprice*0.70
這是Python 3.x還是2.x?在3.x中,'input'返回一個字符串,並且不能比較字符串和數字。 – abarnert