<filename>ch13ex6_numtoeng.py
# ch13ex6_numtoeng
"""The num_to_eng function and its tests."""

eng_numbers = ["Zero", "One", "Two", "Three", "Four",
               "Five", "Six", "Seven", "Eight", "Nine"]

def num_to_eng(num):
    """Return the digits of a number in English as string.

    E.g. num_to_eng(153) == "One Five Three" """
    if num // 10 == 0:
        return eng_numbers[num]
    return f"{num_to_eng(num // 10)} {num_to_eng(num % 10)}"

def num_to_eng_tests():
    assert num_to_eng(153) == "One Five Three"
    assert num_to_eng(12345) == "One Two Three Four Five"
    assert num_to_eng(0) == "Zero"
    assert num_to_eng(100) == "One Zero Zero"

    print("All tests passed!")

<filename>ch13ex6_numtoeng.py
# ch13ex6_numtoeng
"""The num_to_eng function and its tests."""

eng_numbers = ["Zero", "One", "Two", "Three", "Four",
               "Five", "Six", "Seven", "Eight", "Nine"]

def num_to_eng(num):
    """Return the digits of a number in English as string.

    E.g. num_to_eng(153) == "One Five Three" """
    if num // 10 == 0:
        return eng_numbers[num]
    return f"{num_to_eng(num // 10)} {num_to_eng(num % 10)}"

def num_to_eng_tests():
    assert num_to_eng(153) == "One Five Three"
    assert num_to_eng(12345) == "One Two Three Four Five"
    assert num_to_eng(0) == "Zero"
    assert num_to_eng(100) == "One Zero Zero"

    print("All tests passed!")

# ch13ex6_numtoeng The num_to_eng function and its tests. Return the digits of a number in English as string.      E.g. num_to_eng(153) == "One Five Three"