I have a dynamically generated dictionary. Example:
kwargs = { 'name':'Rafi', 'amount': 530}
This dictionary will be used as function parameter. But in case I need to change the value of kwargs['amount']
often (not always).
def printer(**kwargs):
print(kwargs)
for taka in range(100,kwargs['amount'],100):
printer(**kwargs) #Each time (5 time) Output should be: { 'name':'Rafi', 'amount': 100}
kwargs['amount']-=100
printer(**kwargs) #Output should be: { 'name':'Rafi', 'amount': 30}
It is not possible to change the printer(**kwargs)
function. I have to do it through for
loop.
I need to make some data entry, where until the balance is more than 100 ( kwargs['amount'] > 100
), every times $100 will be recorded.
Kindly, help me to figure it out. (Working with django.)