A dictionary cannot have two values with the same key. When a key is repeated in a dictionary literal, only the last occurence will remain. Thus duplicate keys should be either modified or removed.


This rule raises an issue when the same value is used multiple times as a key in a dictionary literal.


== Noncompliant Code Example

[source,text]
----
{"one": 1, "two": 2, "one": 3}  # Noncompliant

def func(a1, a2, a3):
    {a1: 1, a2: 2, a1: 3}  # Noncompliant.
----


== Compliant Solution

[source,text]
----
{"one": 1, "two": 2, "three": 3}

def func(a1, a2, a3):
    {a1: 1, a2: 2, a3: 3}
----


== See

* https://docs.python.org/3/reference/expressions.html#dictionary-displays[Python documentation - Dictionary displays]

