Q: Dictionary Comprehension Query I wasn't able to find out how to do this elsewhere, but it is probably simple. I'm trying to capitalise the value associated with the dict strings, but am currently only able to apitalise the actual key itself.     
strings = {"1234":{'a'}, "2":{'as'}, "4":{'bat'}, "5":{'car'}, "6":{'dove'}, "7":{'python'}}

I know this is not right:
d = {key:key.upper() for key in strings}

This resulted in an error, because I was trying to unpack too many variables:
d = {key:value.upper() for (key,value) in strings}


A: Your values are sets, is that that what you wanted?
You could make them non sets and have them as strings and then use iteritems:
strings = {"1234":'a', "2":'as', "4":'bat', "5":'car', "6":'dove', "7":'python'}

{key: value.upper() for key, value in strings.iteritems()}

Alternatively if they must be sets, you need an aditional layer of iteration
strings = {"1234":{'a'}, "2":{'as'}, "4":{'bat'}, "5":{'car'}, "6":{'dove'}, "7":{'python'}}

{key: {val.upper() for val in value} for key, value in strings.iteritems()}


A: Your second attempt is on the right track, but you have two problems: to iterate over key and value simultaneously, you need the items() method; and you can't capitalize all the elements of a set just by calling upper on it. You'll need to nest a set comprehension inside the dict comprehension.
strings = {"1234":{'a'}, "2":{'as'}, "4":{'bat'}, "5":{'car'}, "6":{'dove'}, "7":{'python'}}

d = {key:{item.upper() for item in value} for (key,value) in strings.items()}
print d

Result:
{'1234': set(['A']), '2': set(['AS']), '5': set(['CAR']), '4': set(['BAT']), '7': set(['PYTHON']), '6': set(['DOVE'])}


A: Because of your value are set object use str to convert them to string then you can use upper method for that :
>>> {key: str(value).upper() for key, value in strings.items()}
{'1234': "SET(['A'])", '2': "SET(['AS'])", '5': "SET(['CAR'])", '4': "SET(['BAT'])", '7': "SET(['PYTHON'])", '6': "SET(['DOVE'])"}

