Valid palindrome solution
Some small nitpicks:

Instead of i &lt;= j you can stop before j by doing: i &lt; j in the last two while loops. That way, you'll save one iteration per while. If you weren't constraint by: &quot;For the purpose of this problem, we define empty string as valid palindrome&quot; you might've remove that as well
Here: ('a'&lt;=source[i]&lt;='z') you can remove the redundant parentheses and also write it like: source[i].isalnum()
It seems like you always forget to put a space between operators: i+=1 should be i += 1.
Add docstrings to your function

Reviewed code:
def check_valid(source):
    &quot;&quot;&quot; Return True/False if a string is a palindrome &quot;&quot;&quot;

    i, j, source = 0, len(source) - 1, source.lower()
    while i &lt;= j:
        while i &lt; j and not source[i].isalnum():
            i += 1
        while i &lt; j and not source[j].isalnum():
            j -= 1
        if i &lt;= j:
            if source[i] != source[j]:
                return False
            else:
                i += 1
                j -= 1
        if i &gt; j:
            return True


if __name__ == &quot;__main__&quot;:
    print check_valid('A man, a plan, a canal: Panama')  # return True
    print check_valid('race a car')  # return False