Python Dictionary Get vs setDefault

# setdefault will insert key with a value of default
# get will not insert key

a = {}
b = a.get('key','value')
print(a,b)
# {} value

a = {}
b = a.setdefault('key','value')
print(a,b)
# {'key': 'value'} value
Combative Crocodile