I am in search of a way to replicate the functionality of a key/value dictionary in Python. My project is utilizing Angular 5 typescript, and I am still exploring the available data types. The ever-changing nature of Angular has made it challenging due to certain datatypes becoming outdated or unsupported.
Here is my objective: If anyone could suggest a reliable resource for guidance, I would be extremely grateful.
Equivalent Code in Python
string = "the bump from the sump in the sump for the trump and the bump"
a = {}
for x in string.split():
if x in a.keys():
a[x] += 1
else:
a[x] = 1
print(a)
for b in a.keys():
if a[b] > 1 and a[b] < 4:
print(b)
if a[b] >= 4:
print(b)