我试图制作一个程序,要求客户输入他们想要的商品数量,purchase.The程序,然后找到小计和总价格与税收。我对如何添加while循环感到困惑,因为它会根据用户放置的项目数量不断询问商品的价格,然后再将所有的项目加在一起。
发布于 2017-10-05 09:01:48
你必须加上你尝试过的东西和你被困的地方。下面是一段伪代码。
read the number of items as num
initialise total to zero
while num > 0:
read the price of the each item as price
calculate the tax and add it to price
add the taxed price of each item to total
decrement num
print sumhttps://stackoverflow.com/questions/46577979
复制相似问题