Problem in inserting new key pairs in Dictionary Python
s = "eat" for i in s: d = dict() d[i] = i if i in d: continue else: d[i] = 1 I have tried several times but it is only appending {‘t’: ‘t’} as output, I’m expecting {‘e’: ‘e’, ‘a’: ‘a’, ‘t’, ‘t’} as the output >Solution : You are creating a new dictionary… Read More Problem in inserting new key pairs in Dictionary Python