It won’t be long in finding one. They abound. Functions have a way of being impure. The simplest way I can find to describe a pure function is the calculus of linear regression. Every term is a pure function. Think on that, and when you have the time we might go down this avenue further.
def f(x): return x
x = 42
y = f(x)
y == x # True
The simplest pure function, identity. It scales up from there.
One neglected to add that maths and programming are each a juxtaposition of the other. They share paradigms and logic, but not a lot else. Ergo, impure functions that maths would not entertain.
In the raw, lambda functions are pretty rare, but as returns from factory functions they are common. This is another avenue to go down. Those functions would also be pure since they do not interact with the outside. They are given a parameter and deal with it. Same outcome every time for the same argument.
The factory function could roll into a scenario where an iterator comes forward. It could manufacture the callback function. Another avenue to go down.
Pure functions and iterators give us a way to write expression based code. The language interprets expressions as values. The more we can learn to write expressive code, the easier it will be to give the computer the values we need it to see.
This is technically a pure function…
My solution - #3 by mtf