小编sak*_*fon的帖子

python if elif else声明

我正在尝试使用python创建一个计算运费的程序.

但是,我无法将程序运行到正常工作的位置.

我的总金额相同,美国为6美元,加拿大为8美元.我似乎无法通过那个.

total = raw_input('What is the total amount for your online shopping?')
country = raw_input('Shipping within the US or Canada?')

if country == "US":
    if total <= "50":
        print "Shipping Costs $6.00"
    elif total <= "100":
            print "Shipping Costs $9.00"
    elif total <= "150":
            print "Shipping Costs $12.00"
    else:
        print "FREE"

if country == "Canada":
    if total <= "50":
        print "Shipping Costs $8.00"
    elif total <= "100":
        print "Shipping Costs $12.00"
    elif total <= "150":
        print "Shipping Costs …
Run Code Online (Sandbox Code Playgroud)

python if-statement nested

20
推荐指数
4
解决办法
10万
查看次数

标签 统计

if-statement ×1

nested ×1

python ×1