Human: check if variable exists in locals. Assistant: 
Here is a Python code to check if a variable exists in locals

import math

def check_var(var):
    """Check if variable exists in locals."""
    if var in locals():
        return True
    else:
        return False

# Enter the variable
var = 'a'

# Calling the function
print((check_var(var)))

#Example Output
# False

#Remember to inspect code for bugs.