Guest User

meh

a guest
Jan 6th, 2018
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. def increasingSequence(seq): # auxiliar
  2.     for i in range(1,len(seq)):
  3.         if seq[i-1]>=seq[i]:
  4.             return False
  5.     else: return True
  6. def almostIncreasingSequence(sequence): # principal
  7.     for i in range(len(sequence)):
  8.         inic = sequence[:i]
  9.         tail = sequence[i+1:]
  10.         inc_inic = increasingSequence(inic)
  11.         inc_tail = increasingSequence(tail)
  12.         cond = inic[-1]<tail[0] if len(inic)*len(tail) else True
  13.         if inc_inic and inc_tail and cond : # si, este codigo da asco, gracias
  14.             return True
  15.     else: return False
Advertisement
Add Comment
Please, Sign In to add comment