Skip to content

Commit 5959958

Browse files
committed
Add new file
1 parent d423ce1 commit 5959958

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

is_sorted.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
def is_sorted_and_how(arr):
2+
if arr == sorted(arr):
3+
return 'yes, ascending'
4+
elif arr == sorted(arr,reverse =True):
5+
return 'yes, descending'
6+
else:
7+
return 'no'
8+
9+
10+
print is_sorted_and_how([1, 2])
11+
print is_sorted_and_how([15, 7, 3, -8])
12+
print is_sorted_and_how([4, 2, 30])

0 commit comments

Comments
 (0)