def minmax(data):
    """Solution to exercise R-1.3.

    Takes a sequence of one or more numbers, and returns the smallest and
    largest numbers, in the form of a tuple of length two. Do not use the
    built-in functions min or max in implementing the solution.
    """
    min_idx = 0
    max_idx = 0
    for idx, num in enumerate(data):
        if num > data[max_idx]:
            max_idx = idx
        if num < data[min_idx]:
            min_idx = idx
    return (data[min_idx], data[max_idx])