python - how do i increase the min and max on my number list? -


i'm creating game in python ran trouble when creating level system. ya see attack created list 1(min) 10(max) , every level gains want min , max of list increase 1 how should if possible? i'm coding in python 3.2

char ={     'atk':[1,10],     'hp':100,     'name': 'ruby',     'age': 1,     'weapon': 'scythe',     'lvl': 1,     'xp': 0,     'nextlvl': 50,     'stats': {         'str': 1,         'dex': 1,         'vit': 1 }} while char['xp'] >= char['nextlvl']:     char['lvl'] += 1     char['nextlvl'] = char['nextlvl'] * 3     char['stats']['str'] +=1     char['stats']['dex'] +=1     char['stats']['vit'] +=1     char['atk'] +=1 <-- problems right here     print('level:', char['lvl'],'exp:', char['xp'],'nextlvl:', char['nextlvl'])     print('str:', char['stats']['str'], 'dex:', char['stats']['dex'], 'vit:', char['stats']['vit']) 

the following it:

char['atk'] = [atk + 1 atk in char['atk']] 

you increment 2 numbers (the min , max) individually:

char['atk'][0] = char['atk'][0] + 1 char['atk'][1] = char['atk'][1] + 1 

if think unwieldy, might want consider storing min , max in 2 separate dictionary entries.


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -