# Are there dictionaries in math?

Consider the following dictionary in the programming language Python:

D = {'A': 1, 'B': 2, 'C': 3}

It is saying that the value of A is 1, the value of B is 2, and the value of C is 3. It also has the property that D[‘A’] = 1 etc.

How would I write such thing in math? I was thinking about

However, I am not sure if this is the right or best way to do such thing.

I would like to use the structure for taking sums: e.g. ‘AAAA’ is interpreted as $1+1+1+1$ etc. What kind of notation should I use?

A dictionary is just a function $\mathrm{Dict}\colon \mathrm{Keys} \rightarrow \mathrm{Values}\cup\{\epsilon\}$ where $\epsilon$ is a “null character” with the understanding that $\epsilon\notin\mathrm{Values}$.
For example, let $\mathrm{Keys}=\{A,B,C,...,Z\}$, and $\mathrm{Values}=\mathbb{Z}$. Then, in your case,