Reputation: 181
I have few coordinates of places in a map(for eg: Delhi(-172,300),Mumbai(-200,90). Can anyone please tell me how to create a list or tuple in python such that each entity (here: delhi) have corresponding coordinates along with it in a list. That is,When I call a place, I need its coordinates to be displayed.
Also I need to add edge for a vertex along with coordinates.For eg. Delhi with coordinates (-172,300) must have an edge with another vertex Mumbai(-200,90) also need to add the weight of the edge.
Upvotes: 0
Views: 30
Reputation: 1216
As has been commented, a dictionary is more appropriate for your use case. Just to complete and clarify the answer, you can do something like:
places = {'Delhi': (-172, 300), 'Mumbai': (-200, 90)}
Then access coordinates of a place by: places['Delhi']
Upvotes: 1