逻辑稍有问题
w = int(input("重量:"))
sfjj = input("是否加急Y/N, y/n")
if sfjj not in ["Y", "y", "N", "n"]:
print("输入错误")
else:
cost = 8
if w > 1000:
cost += math.ceil((w - 1000) / 500) * 4
if sfjj in ["Y", "y"]:
cost += 5
print("cost", cost)