Transforming an array: take the square root of each perfect square, else square the number
Naming conventions aside (short names in camelCase are typically used in Go), this is the right way of doing what you want. The authors of Go have a different view of what is more readable &amp; maintainable than the authors of Python :-)