int类型数据不可迭代,然后嘞,这个要怎么改呀。我的代码是这样的: total=1500 price=eval(input("请输入书包价格:")) for i in price: left=total-i*0.85 print("书包折后价:",i*0.85) print("剩余的钱:",left)
total=1500
while True:
inp=input("请输入书包价格: ")
if inp == 'q':
break
price = float(inp)
left = total-price*0.85
print("书包折后价:", price*0.85)
print("剩余的钱:", left)
while True:
total = 1500
price = eval(input("请输入书包价格:"))
left=total-price*0.85
print("书包折后价:",price*0.85)
print("剩余的钱:",left)
你的意思是这样的吗?如果不是可以把描述更详细些.