Kodewick
Start learning →
Starter←→0 / 70

Pet hotel guest

#037StarterMaps2 min

The pet hotel keeps rooms: each pet's room number. Write IsStaying(rooms, pet) to return true if the pet is staying there and false if not. Room 0 is a real room too.

Examples
IsStaying(map[string]int{"Mochi": 3, "Bean": 5}, "Bean")→True
IsStaying(map[string]int{"Mochi": 3}, "Rex")→False
The functionfunc IsStaying(rooms map[string]int, pet string) bool
main.go
package main

func IsStaying(rooms map[string]int, pet string) bool {
	// your code here: look up pet in rooms; return true if it's there
	return false
}
Ctrl + Enter runs too
Result

Run tries the examples. When they look right, Submit.