[Solved] First character in a dictionary Python [closed]


Your dict is the wrong way round. The thing you want to look up (key) goes first in each pair

pCode = {"T": "Alberta"}
a = input("Enter a 6 character postal code: ")

You can get the first character of the post code as a[0]

print(pCode.get(a[0]))

solved First character in a dictionary Python [closed]