int类型数据不可迭代,然后嘞,这个要怎么改呀。我的代码是这样的: total=1500 price=eval(input("请输入书包价格:")) for i in price: left=total-i*0.85 print("书包折后价:",i*0.85) print("剩余的钱:",left)
2条回答 默认 最新
- coagenth 2021-03-22 19:13关注
total=1500 while True: inp=input("请输入书包价格: ") if inp == 'q': break price = float(inp) left = total-price*0.85 print("书包折后价:", price*0.85) print("剩余的钱:", left)
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 1无用