Pattern: Duplicate key in dictionary
Issue: -
When dictionary key is redefined, it overwrites the key's value. This may lead to unexpected behavior and hard to detect bugs. Remove any duplicate keys to resolve this issue.
Example of incorrect code:
wrong_dict = {
'tea': 'for two',
'two': 'for tea',
'tea': 'time',
}
Example of correct code:
correct_dict = {
'tea': 'for two',
'two': 'for tea',
}