Question: 
Write a function to find the number of flips required to make the given binary string a sequence of alternate characters.


Model's Code:
def min_flip_to_make_string_alternate(s):
    count1 = count2 = 0
    for i in range(len(s)):
        expected_char1 = '0' if i % 2 == 0 else '1'
        expected_char2 = '1' if i % 2 == 0 else '0'
        if s[i] != expected_char1:
            count1 += 1
        if s[i] != expected_char2:
            count2 += 1
    return min(count1, count2)



Sample Correct Code:
def make_flip(ch): 
	return '1' if (ch == '0') else '0'
def get_flip_with_starting_charcter(str, expected): 
	flip_count = 0
	for i in range(len( str)): 
		if (str[i] != expected): 
			flip_count += 1
		expected = make_flip(expected) 
	return flip_count 
def min_flip_to_make_string_alternate(str): 
	return min(get_flip_with_starting_charcter(str, '0'),get_flip_with_starting_charcter(str, '1')) 


Asserts:
assert min_flip_to_make_string_alternate("0001010111") == 2
assert min_flip_to_make_string_alternate("001") == 1
assert min_flip_to_make_string_alternate("010111011") == 2 


Tests:
Test 1 of 3: PASS
Test 2 of 3: PASS
Test 3 of 3: PASS

Test 364 of 974: 263/364 (72.25274725274726%): success