-5

I want to be able to print out just a single character from this dictionary but I haven't been able to figure out the syntax or find it anywhere. Is there a way to do this in vanilla Python 2.7.x given the code below?

dct = {"c":[["1","1","0"],["0","0","0"]], "d":[["1","1","0"],["1","0","0"]],}
for x in dct:
    print [x][0][0]

I want the output to be: 11

Any help is much appreciated!

Andy
  • 145
  • 11
  • It looks like you want the first value of the first sub-list of each of the value lists. Do you care what order they come out in? Iterating over the entries in a dict doesn't guarantee order. – Tom Karzes Oct 02 '17 at 23:46
  • maybe something like `for x in dct.keys(): print ''.join(dct[x][0][0:2])`, but I'm not sure which indices in the values you are getting the `1`s from... – chickity china chinese chicken Oct 02 '17 at 23:47

1 Answers1

0
for x in dct:
    print(dct[x][0][0])
Sergey Vasilyev
  • 3,919
  • 3
  • 26
  • 37