Skip to content

Commit

Permalink
Add solution for simple fun coord helper
Browse files Browse the repository at this point in the history
  • Loading branch information
Sigmanificient committed Nov 13, 2024
1 parent 8a213ad commit efb3278
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/python/katas/py6kyu/simple_fun_coordinate_helper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"""Kata url: https://www.codewars.com/kata/5936107d40ed69ea1e00003d."""

"""Kata url: https://www.codewars.com/kata/5936107d40ed69ea1e00003d."""

def coordinate_helper(cmd):
x=y=0
getd=lambda d,s:(d==s[0])-(d==s[1])
for d, n in cmd:
if d and (n:=d[1:]).isdigit():
x += getd(d,"DA") * int(n)
y += getd(d,"WS") * int(n)
return x, y

0 comments on commit efb3278

Please sign in to comment.