python 先判断输入(N/Y),根据输入结果执行想要语句,为什么我输入Y出错,该怎么改?


N_Y = input("是否带电(N/Y):")
while 4:    
    if N_Y == "N":           
            goods_weight = int(input("请输入货物重量(g):"))
            #print(type(goods_weight ))       
            if goods_weight > 2000:
                    print("超出路线重量范围,请重新输入1-2000g:") 
                    continue
            elif goods_weight < 80:                #计算0-79g重量范围包裹的各个国家运费
                all_contury_freight_pu_sheet4 =4
                break   #若输入的是数字,则退出循环继续下面代码 
            elif 80 <= goods_weight < 2000:                #计算80-2000g重量范围包裹的各个国家运费
                all_contury_freight_pu_sheet4 =5
                break                
    elif N_Y == "Y":       
            goods_weight = int(input("请输入货物重量(g):"))
            #print(type(goods_weight ))       
            if goods_weight > 2000:
                    print("超出路线重量范围,请重新输入1-2000g:") 
                    continue
            elif goods_weight < 80:                #计算0-79g重量范围包裹的各个国家运费
                all_contury_freight_pu_sheet4 =6
            elif 80 <= goods_weight < 2000:                #计算80-2000g重量范围包裹的各个国家运费
                all_contury_freight_pu_sheet4 =7
                break   #若输入的是数字,则退出循环继续下面代码       
print(all_contury_freight_pu_sheet4)

你得再发个报错信息,让我看看咩