solutions

All strings

Modify the function all_strings so it returns True if all the parameters passed are of type string (str).

Hint: you can use the type function. Use the run code button to run the example.

Examples:

all_strings('j', 'rmotr', 'Python')  # True
all_strings('', 'rmotr', 'Python')  # True

all_strings(3, 'rmotr', 'Python')  # False
all_strings('hello', None, 'Python')  # False

Test Cases

test with none - Run Test

def test_with_none():
    assert all_strings('hello', None, 'Python') == False

test with empty string - Run Test

def test_with_empty_string():
    assert all_strings('', 'rmotr', 'Python') == True

test with a number - Run Test

def test_with_a_number():
    assert all_strings(3, 'rmotr', 'Python') == False

test with all strings - Run Test

def test_with_all_strings():
    assert all_strings('j', 'rmotr', 'Python') == True