-3

I'm trying to get chr() output from 65 to 90:

I want to get a dictionary that looks like this:

{65: 'A', 66: 'B', ..... 90: 'Z'}

jscs
  • 63,694
  • 13
  • 151
  • 195

1 Answers1

0

You just need a simple dict comprehension

>>> {x: chr(x) for x in range(65, 91)}
{65: 'A', 66: 'B', 67: 'C', 68: 'D', 69: 'E', 70: 'F', 71: 'G', 72: 'H', 73: 'I', 74: 'J', 75: 'K', 76: 'L', 77: 'M', 78: 'N', 79: 'O', 80: 'P', 81: 'Q', 82: 'R', 83: 'S', 84: 'T', 85: 'U', 86: 'V', 87: 'W', 88: 'X', 89: 'Y', 90: 'Z'}
han solo
  • 6,390
  • 1
  • 15
  • 19