You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Tiago Collot 4d13d88fa7 docs(shoppinglistsort): fix subject information 2 years ago
..
README.md docs(shoppinglistsort): fix subject information 2 years ago

README.md

shoppinglistsort

Instructions

You were sent to the supermarket with a shopping list. To make your shopping faster, write a function ShoppingListSort() that takes a slice of strings and sorts it, according to the string length, returning a slice in which the strings appear in ascending order.

When the length of string elements are equal, then the order in which they appear does not matter.

Expected function

func ShoppingListSort(slice []string) []string {

}

Usage

Here is a possible program to test your function:

package main

import (
        "fmt"
        "piscine"
)

func main() {
        slice := []string{"Banana", "Mushroom", "Salt", "Pepper","Tea", "Milk"}
        fmt.Println(piscine.ShoppingListSort(slice))
}

And its output:

$ go run . | cat -e
[Tea Salt Milk Banana Pepper Mushroom]$