# Write the function.

def coinDistance():

# Find the nearest coin,

item = hero.findNearestItem()

```
# If there is a coin, return the distance to it.
if item:
return item
# Else, return 0 (zero).
else:
return 0
pass
```

while True:

distance = coinDistance()

if distance > 0:

# Say the `distance`

.

hero.say(distance)

pass