I would like to create dictionary of the format in the example below.
c={
'A':{('AB',2.9)},
'B':{('AS',3.9)},
'R':{('D',2.0)},
'V':{('AD',2.9)},
'G':{('AX',2.9)}
}
I have this tuples feed in a loop. Here is what I have tried but I get a wrong format from this.
my_tuple = ('AB',2.9)
c = {}
my_key = 'A'
c.update({my_key:{my_tuple}})
For this specific case I would like to get {'A': set([('AB', 2.9)])}
. I understand this is a proper dictionary but how can do it better and return value of c
in a format?. I want i.e.:
{'A': {('AB', 2.9)}}