The code below should create a function to calculate and return the sum of all of the even numbers from 0 to the passed number being 10(inclusive) using a while loop. But instead, it just creates an infinite loop and I don't know why.
def function(lex):
zero = 0
while zero <= lex:
while lex % 2 == 0:
print(lex)
zero = zero + 1
while lex % 2 =! 0:
zero = zero + 1
return sum
print(function(10))