Creating polygon feature class from X,Y coordinates using ArcPy?

To:

Write a script that creates a new polygon feature class containing a single ( square ) polygon with the following coordinates: ( 0, 0 ), ( 0, 1,000 ), ( 1,000, 0 ), and ( 1,000, 1,000 ).

I would take the following approach, which is a slight adaptation from the Insert Cursor documentation example.

import arcpy

# Create a polygon geometry
array = arcpy.Array([arcpy.Point(0, 0),
                     arcpy.Point(0, 1000),
                     arcpy.Point(1000, 1000),
                     arcpy.Point(1000, 0)
                     ])
polygon = arcpy.Polygon(array)

# Open an InsertCursor and insert the new geometry
cursor = arcpy.da.InsertCursor(r'C:\path\to\your\geodatabase.gdb\polygon', ['SHAPE@'])
cursor.insertRow([polygon])

# Delete cursor object
del cursor

In your question it is hard to tell where the exercise you are trying to complete finishes and your code attempt starts, but it is my suspicion that the code below will give you the same error:

import fileinput
import string
import os

infile = "D:/UW/Winter_2016/501/w5_more_arcpy8_9_10/ex8/coordinatesEx8.txt"

for line in fileinput.FileInput(infile):
    ID, X, Y = string.split(line, " ")
fileinput.close()

If so, then you can conclude that you are encountering a Python (IT), rather than ArcPy (GIS) issue, that should be researched/asked at Stack Overflow rather than here.