The bakery is making a double batch today. The recipe's grams of each ingredient are in grams. Write DoubleRecipe(grams) to return a new slice with every amount doubled, in the same order.
DoubleRecipe([]int{200, 50, 3})→[400, 100, 6]DoubleRecipe([]int{})→[]func DoubleRecipe(grams []int) []intpackage main
func DoubleRecipe(grams []int) []int {
double := make([]int, len(grams))
for i, g := range grams {
// your code here: set place i to twice g
}
return double
}
Run tries the examples. When they look right, Submit.