次のような辞書があるとします。
sample_dict = {'test':['a', 'b', 'c', 'd', 'e']}
リスト内のアイテムを別のものに変更するにはどうすればよいですか。
例:
def replace_item(sample_dict, item, new_item):
pass
>>> replace_item({'test':['a', 'b', 'c', 'd', 'e']}, 'd', 'f')
>>> {'test':['a', 'b', 'c', 'f', 'e']}