Skip to content

Commit a90d41b

Browse files
authored
Merge pull request darkprinx#30 from pratikb0501/patch-3
Update Day 7.md
2 parents 8449fa2 + 36d5d4b commit a90d41b

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Status/Day 7.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,29 @@ dist = round(math.sqrt(x**2 + y**2)) # euclidean distance = square root of (x^2
142142
print(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")

0 commit comments

Comments
 (0)