First, the moreone obvious approach :
def square(n: int):
return n*nint(n)*(n)
Now, what distinguishes these approaches ? Strictly speaking, all 3 of them fit the bill and answer the question. What is informative to a developer is understanding the ups and downs of each approach. For example, the first option will also work with some strings whereas the second will fail. This can be good or bad depending on context, and can lead to all sorts of discussions about best practices around dynamic typing in Python, like for example should some functions strictly check type or should you embrace duck typing at all times ?