### re: Daily Challenge #5 - Ten Minute Walk VIEW POST

Here's a trivial solution in Python

``````def get_walk(minutes):
if minutes % 2 != 0:
# Only even minute times are possible, as you always need to walk the same distance east as west,
# andnortha s sound.
raise ValueError("Only walks with an even number of minutes are possible")

half = minutes / 2
return half * ['n'] + half * ['s']

``````

If you add the requirement that you can't walk the same street twice...

``````def get_walk(minutes):
if minutes % 2 != 0:
# Only even minute times are possible, as you always need to walk the same distance east as west,
# andnortha s sound.
raise ValueError("Only walks with an even number of minutes are possible")

# We'll return a rectangle with width 1, so the two short sides combined take 2 minutes
# We'll divide the remaining minutes by 2 to know how long the other sides should be.
length = (minutes - 2) / 2

return ['n'] + length * ['e'] + ['s'] + length * ['w']

``````
code of conduct - report abuse