Skip to content

Commit 09cf635

Browse files
committed
added degree to direction logic
1 parent b2fe2c0 commit 09cf635

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Diff for: compass_code.py

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
def degree_to_direction(deg):
2+
directions = ["N", "NE", "E", "SE", "S", "SW", "W", "NW"]
3+
4+
deg = deg% 360
5+
deg = int(deg//45)
6+
print(directions[deg])
7+
8+
degree_to_direction(45)

0 commit comments

Comments
 (0)