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.

23rd Apr 2019, 6:45 PM
Anubhav A
Anubhav A - avatar
4 Réponses
+ 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
23rd Apr 2019, 8:08 PM
Dragos
Dragos - avatar
+ 1
If you want the sels not to exceeds 50 you may adjust the while condition as while s <= 50.
26th Apr 2019, 8:05 PM
Dragos
Dragos - avatar
0
Thanks buddy
26th Apr 2019, 2:31 PM
Anubhav A
Anubhav A - avatar
0
How can we stop it on 50 if the sell is exceeds
26th Apr 2019, 2:38 PM
Anubhav A
Anubhav A - avatar