
    In an automated grading system, develop a function that analyzes a sequence of student assessment scores (containing both negative points for incorrect answers and positive points for correct answers) and reorganizes the most recent n scores to group all negative scores before positive ones while maintaining their chronological sequence within each group. This reorganization should help identify clear patterns of learning gaps (negative scores) and successful comprehension (positive scores) in the student's recent performance history.
    

    
def re_arrange_array(arr, n):
    """
    In an automated grading system, develop a function that analyzes a sequence of student assessment scores (containing both negative points for incorrect answers and positive points for correct answers) and reorganizes the most recent n scores to group all negative scores before positive ones while maintaining their chronological sequence within each group. This reorganization should help identify clear patterns of learning gaps (negative scores) and successful comprehension (positive scores) in the student's recent performance history.
    

    """
def re_arrange_array(arr, n):
    """
    In an automated grading system, develop a function that analyzes a sequence of student assessment scores (containing both negative points for incorrect answers and positive points for correct answers) and reorganizes the most recent n scores to group all negative scores before positive ones while maintaining their chronological sequence within each group. This reorganization should help identify clear patterns of learning gaps (negative scores) and successful comprehension (positive scores) in the student's recent performance history.
    

    """
    j = 0
    for i in range(0, n):
        if arr[i] < 0:
            temp = arr[i]
            arr[i] = arr[j]
            arr[j] = temp
            j = j + 1
    return arr