-1

So, this a piece of code for one of my assignments and I'm trying to check for continuity between intervals(lists of sorted numbers), here is the code:

def check_connections(new_interval):
    for interval in interval_list[:]:
        if min(new_interval) == max(interval)+1:
            interval += new_interval  #this one works
            return True
        if max(new_interval) == min(interval)-1:
            interval = new_interval + interval  #this one doesn't 
            return True
    return False

What's the difference between those two lines and why one works and the other doesn't? Thx

bonifacil
  • 9
  • 2

0 Answers0