Sorting operations

Report a typo

SpongeBob created a Go program that has a slice f of the Food type:

package main

import (
    "fmt"
    "sort"
)

type Food struct {
    Name, Emoji string
    Price       float64
}

func main() {
    f := []Food{
        {"Krabby Patty", "🍔", 2.00},
        {"Seaweed Salad", "🥗", 1.50},
        {"Coral Fries", "🍟", 1.50},
    }
    // The selected sorting operation goes here!

    fmt.Println(f)
}

Please select which one of the sorting operations below he has performed to get the following result:

[{Seaweed Salad 🥗 1.5} {Coral Fries 🍟 1.5} {Krabby Patty 🍔 2}]
Select one option from the list
___

Create a free account to access the full topic