Advertisement
Guest User

Untitled

a guest
Feb 18th, 2020
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. def is_ascending(list_):
  2. for i in range(len(list_) - 1):
  3. if list_[i] > list_[i + 1]:
  4. return False
  5. return True
  6.  
  7.  
  8. def is_descending(list_):
  9. for i in range(len(list_) - 1):
  10. if list_[i] < list_[i + 1]:
  11. return False
  12. return True
  13.  
  14.  
  15. def is_monotonous(list_):
  16. if is_ascending(list_):
  17. return True
  18. if is_descending(list_):
  19. return True
  20. return False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement