Sorting math constants

Report a typo

Below you will see a Go program that sorts a slice of float64 mathematical constants:

package main

import "sort"

func main() {
    constants := []float64{1.618, 3.1416, 2.718, 1.414, 0.577}
    sort.Slice(constants, func(i, j int) bool {
        return constants[i] > constants[j]
    })
}

Write below what will be the number in the second index (constants[2]) of the slice after it has been sorted.

Enter a number
___

Create a free account to access the full topic