0
How can we make a program in Python of stock management. That every previous result will count.
We have 50 pen,when we sell 5 pen there will be two columns in result sell=5 and remain=45 again we sell 3 the result will be sell=8 remain=42 how can add previous result in upcoming value. Please answer this.
4 odpowiedzi
+ 2
I'm not sure I understand what you want but maybe this is a solution you're searching:
pen = 50
s = 0
while 1:
sell = input('sell = ')
if sell:
s += int(sell)
pen -= int(sell)
print('sells', 'pen' )
print(s, ' ',pen)
else:
break
+ 1
If you want the sels not to exceeds 50 you may adjust the while condition as while s <= 50.
0
Thanks buddy
0
How can we stop it on 50 if the sell is exceeds