Fix this code: simple add

For this assignment, you'll have to fix the code that we have provided. It might be something missing, or completely broken. Your job is to figure it out.

You'll have to discover problem by its context. Mainly, reading the tests and the provided code.

Why are we doing this, you might ask? This is a highly common scenario in the professional life of a developer. It's not always just about writing new code, but also about fixing something that has been already coded (a partial solution).

It's also very important to learn how to read errors in Python and understand when those test cases are failing.

Good luck!

Test Cases

test function add broken - Run Test

def test_function_add_broken():
    assert add(2, 'a') == None

test function add working - Run Test

def test_function_add_working():
    assert add(2, 3) == 5

Solution 1

def add(a, b):
    if type(a) != int or type(b) != int:
        return None
    return a + b
def add(a, b): return a + b