Is string

Define a function is_string that receives a variable and if it is a string
returns True and if not returns False.

Hint: Use the isinstance function.

Examples:

>>> is_string('happy')
True
>>> is_string(27)
False

Test Cases

test integer - Run Test

def test_integer():
    assert is_string(27) is False

test string - Run Test

def test_string():
    assert is_string('happy') is True

Solution 1

def is_string(variable):
    if isinstance(variable, str):
        return True
    return False
def is_string(variable): pass