辞書のキーに新しい値を割り当てようとしています。しかし、「ValueError: 基数 10 の int() のリテラルが無効です:」というメッセージが表示されます。
balance = {'beer':5, 'toast':2}
item = input("what did you eat?: ")
price = input("how much?: ")
if item not in balance:
balance[item] = int(price)
else:
balance[item] = balance[item] + int(price)
python shell で balance['beer'] = 5 を実行できるので、私は困惑しています。何が欠けていますか?