Conditional multiplication

Define a function conditional_multiplication that receives a boolean and a
number and returns a number. If the boolean is True the number returned is
multiplied by 10. In other case, it returns it unchanged.


# Boolean is True, multiply it by 10
>>> conditional_multiplication(True, 2)

# Boolean is False, return it as it is
>>> conditional_multiplication(False, 5)

Test Cases

test true condition - Run Test

def test_true_condition():
    assert conditional_multiplication(True, 5) == 50

test false condition - Run Test

def test_false_condition():
    assert conditional_multiplication(False, 5) == 5

Solution 1

def conditional_multiplication(a_condition, number):
    if a_condition:
        number *= 10
    return number
def conditional_multiplication(a_condition, number): pass