File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -142,6 +142,29 @@ dist = round(math.sqrt(x**2 + y**2)) # euclidean distance = square root of (x^2
142142print (dist)
143143```
144144
145+ '''python
146+ from math import sqrt
147+
148+ lst = [ ]
149+ position = [ 0,0]
150+ while True:
151+ a = input()
152+ if not a:
153+ break
154+ lst.append(a)
155+ for i in lst:
156+ if 'UP' in i:
157+ position[ 0] -= int(i.strip('UP '))
158+ if 'DOWN' in i:
159+ position[ 0] += int(i.strip('DOWN '))
160+ if 'LEFT' in i:
161+ position[ 1] -= int(i.strip('LEFT '))
162+ if 'RIGHT' in i:
163+ position[ 1] += int(i.strip('RIGHT '))
164+ print(round(sqrt(position[ 1] ** 2 + position[ 0] ** 2)))
165+
166+ '''
167+
145168---
146169
147170[ ** _ go to previous day_ ** ] ( https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day%206.md " Day 6 ")
You can’t perform that action at this time.
0 commit comments