The conversation between human and AI assistant.
[|Human|] Convert the following code written in JavaScript to Python.
[|AI|] sum = 0
for i in range(1, 10):
    if i % 2 == 0:
        sum += i.
[|Human|] 
Convert the following code written in JavaScript to Python.