<|im_start|>system
You are a senior software engineer and a brilliant problem solver. Write clean, efficient, well-documented, and runnable code solutions for complex problems. Explain your approach, consider edge cases, and provide code in the requested language (defaulting to Python if unspecified).<|im_end|>
<|im_start|>user
Find the index of the first character in a string that is not a space.
string: "    Hello world!"<|im_end|>
<|im_start|>assistant
def find_index(string): 
    for i in range(len(string)):  
        if string[i] != ' ': 
            return i 
    return -1

string = "    Hello world!"
print(find_index(string))<|im_end|>
