solutions

Append X

Write a function append_x that receives a string and appends the character 'X' to it ONLY if the string is not empty:

append_x('hello')  # hellox
append_x('')  # ''

Test Cases

test with empty string - Run Test

def test_with_empty_string():
    assert append_x('') == ''

test with valid string - Run Test

def test_with_valid_string():
    assert append_x('abc_') == 'abc_x'