def when_did_it_die(P0, days):
    """
    Given a P0 and an array of days in which it was alive, censored or dead,
    figure out its lifespan and the number of days it was alive'
    
    Note, the lifespan is considered to last up to the last observation.
    I.e., a worm that was observed to live 3 days, and died on day 4
    would have a lifespan of 4 days.     
    
    If a worm wasn't observed to die, it is considered censored for all practical
    purposes
    
    P0= a unique identifier, typically a number, always a scalar or a string
    days= an array or array-like of floats or ints consisting of -1, 0, or 1
    
    returns:
    Worm Identifier, Lifespan, Death Observed(1) or Censored (0)
    """
    counter=0
    for day in days:
        if day == 0: #worm died, add last day and return
#            counter+=1
            return [P0, counter, 1]
        elif day == -1: #worm was censored, add last day and return
#            counter+=1
            return [P0, counter, 0]
        elif day == 1:
            counter+=1
    return [P0, counter, 0]