Add items in nested dictionaries based on ID number in python
<p>I have dictionaries nested in a list. The dictionaries are set up as follows:</p>

<p><code>{'ID': 123, 'Balance': 45, 'Comments': None}</code></p>

<p>I have multiple of these dictionaries in a list, so the list looks like this:</p>

<pre><code>[{'ID': 123, 'Balance': 45, 'Comments': None}, {'ID': 456, 'Balance': 78, 'Comments': None}]
</code></pre>

<p>What I'm trying to do, is check to see if there is already a dictionary with the ID from the input in the list, and if there is, add the Balance from the input. 
Is there any readable pythonic way to do this?</p>

<pre><code>accounts = [
    {'ID': 123, 'Balance': 45, 'Comments': None}, 
    {'ID': 456, 'Balance': 78, 'Comments': None},
]

def update_balance(account_id, amount):
    account = next((a for a in accounts if a['ID'] == account_id), None)
    if account:
        account['Balance'] += amount
        return account

account = int(input('Account ID: '))
amount = float(input('Amount: '))

update_balance(account, amount)
</code></pre>

python list dictionary nested