編集できる辞書が必要です。まったく新しい値を追加するのではなく、「クラス」に追加する??? 辞書の中身。例えばキャラクターのステータス。
if race == 'orc':
if Class == 'worrier':
stats = ['strength': 6, 'intelligence': 2]'
強度を上げるにはどうすればいいですか?(辞書を追加できないことはわかっています。そのため、同様のものが必要です)。
編集できる辞書が必要です。まったく新しい値を追加するのではなく、「クラス」に追加する??? 辞書の中身。例えばキャラクターのステータス。
if race == 'orc':
if Class == 'worrier':
stats = ['strength': 6, 'intelligence': 2]'
強度を上げるにはどうすればいいですか?(辞書を追加できないことはわかっています。そのため、同様のものが必要です)。
char = {"race" : "orc", "class" : "worrier", "stats" : {"strenght" : 6, "intelligence" : 2}}
char["stats"]["strenght"] += 1
# output -> {'race': 'orc', 'stats': {'intelligence': 2, 'strenght': 7}, 'class': 'worrier'}
# Append something to stats
char["stats"].update({"stamina" : 5})
# output -> {'race': 'orc', 'stats': {'stamina': 5, 'intelligence': 2, 'strenght': 7}, 'class': 'worrier'}
なぜstats['strength'] = stats['strength'] + n
ですか?