def simple_format(format, *args):
    """
    Returns a formatted string by replacing all instances of %X with Xth argument in args (0...len(args))
    e.g. "%0 says hello", "ted" should return "ted says hello"
    "%1 says hello to %0", ("ted", "jack") should return jack says hello to ted etc.
    If %X is used and X > len(args) it is returned as is.
    """
    index = 0
    while index < len(args):
        format = format.replace("%" + str(index), args[index])
        index += 1
    return format