Find the longest sequence Problem:
Find the longest sequence consisting only of 0's, and the longest sequence consisting only of 1's?
Solution:
import sys

longestSequenceForOne = None
startIndexForOne = None
longestSequenceForZero = None
startIndexForZero = None

def setLongestSequence(array, longestSequence, startIndex):
    global longestSequenceForOne
    global startIndexForOne
    global longestSequenceForZero
    global startIndexForZero

    if array[startIndex] == 1:
        if longestSequenceForOne == None or longestSequenceForOne &lt; longestSequence:
            longestSequenceForOne = longestSequence
            startIndexForOne = startIndex
    elif array[startIndex] == 0:
        if longestSequenceForZero == None or longestSequenceForZero &lt; longestSequence:        
            longestSequenceForZero = longestSequence
            startIndexForZero = startIndex

def findLongestSequence(array, size):
    &quot;&quot;&quot;
    Find the longest sequence of 0's and 1's
    &quot;&quot;&quot;
    longestSequence = 1
    beginIndex = None
    index = 1
    startIndex = 0
    sameElementCount = 1

    while (index &lt; size):
        if array[index] == array[index-1]:
            sameElementCount += 1
        elif sameElementCount &gt; longestSequence:
            longestSequence = sameElementCount
            startIndex = index - sameElementCount
            sameElementCount = 1
            setLongestSequence(array, longestSequence, startIndex)
        else:
            sameElementCount = 1
        index += 1
    if sameElementCount &gt; longestSequence:
        longestSequence = sameElementCount
        startIndex = index - sameElementCount
        setLongestSequence(array, longestSequence, startIndex)

if __name__ == '__main__':
    size = int(input())
    if size &lt; 2 or size &gt; 100:
        sys.exit()
    array = [int(x) for x in input().split() if x == '1' or '0']
    if len(array) != size:
        sys.exit()
    findLongestSequence(array, size)
    print(startIndexForZero, longestSequenceForZero)
    print(startIndexForOne, longestSequenceForOne)


Correctness
Input

12
0 1 0 1 1 1 0 1 0 0 0 0

Output

8 4
3 3

Input
17
1 1 0 1 0 1 0 0 1 0 0 0 0 1 0 1 0

Output

9 4
0 2


Questions:

Does the code require better error handling?

Can this code get more pythonic?
Correctness

Input
1 1 1 1 0 0 0

Output
None, None
0, 4


The reason is obvious: the longestSequence does not distinguish between longest sequence of zeroes and longest sequence of ones, so 0 0 0 is not considered long enough.
General


Avoid globals; prefer returning values.
There is no need to pass size; a list already knows its size. For the same reason, size = int(input()) is redundant and reduces usability.