please take a look
>>> var = "name"
>>> dict(var=12)
{'var': 12}
but I need {‘name’: 12}
How to do this ?
I use dict() not dict[element] because in such a way that append element to my dict(graph is also Dictionary):
graph[v1] = dict(graph[v1], v2=weight)
Please help, how to do it or modify my append method
I think you need
No need to recreate the whole dictionary just to add a new item.