If we have that a function is a relation between two variables such as the independent variable, x, has exactly one independent variable, y, then, we can say that the function in the program is a function.
Each state has only one capital. It is not the case, that, for example, one state has two capitals, in which case the relation is not a function.
Therefore, if we have a program that would take the name of a state as an input, and as an output the name of its capital, it would be a function.