Kodewick
Empieza a aprender →
Básico←→0 / 70

Objetos perdidos

#039Básicoplace, ok := shelf[item]3 min

El map shelf de la oficina de objetos perdidos dice dónde se guarda cada objeto. Escribe FoundAt(shelf, item) para devolver dónde está el objeto, como "box 3", o "not found" si no está en el map.

Ejemplos
FoundAt(map[string]string{"umbrella": "shelf A", "scarf": "box 3"}, "scarf")→'box 3'
FoundAt(map[string]string{"umbrella": "shelf A"}, "keys")→'not found'
La funciónfunc FoundAt(shelf map[string]string, item string) string
main.go
package main

func FoundAt(shelf map[string]string, item string) string {
	// tu código aquí: busca dónde está item y devuélvelo si está
	return "not found"
}
Ctrl + Enter también ejecuta
Resultado

Ejecutar prueba los ejemplos. Cuando salgan bien, Enviar.