solutions

Only integers

Define a function add_only_integers that receives two numbers and returns
the sum of them ONLY if they’re both integers. If that’s not the case, the
function should return the string "invalid parameters".

Examples:

>>> add_only_integers(2, 3)
5
>>> add_only_integers(2, 'what')
'invalid parameters'

Test Cases

test integers - Run Test

def test_integers():
    assert add_only_integers(2, 3) == 5

test not integers - Run Test

def test_not_integers():
    assert add_only_integers(2, 'what') == 'invalid parameters'