Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def is_ascending(list_):
- for i in range(len(list_) - 1):
- if list_[i] > list_[i + 1]:
- return False
- return True
- def is_descending(list_):
- for i in range(len(list_) - 1):
- if list_[i] < list_[i + 1]:
- return False
- return True
- def is_monotonous(list_):
- if is_ascending(list_):
- return True
- if is_descending(list_):
- return True
- return False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement