#import the namedtuple factory method
from collections import namedtuple
#create a namedtuple to represent a Point
Point = namedtuple('Point', ['x', 'y'])
#Create objects from the namedtuple 'Point'
p = Point(3, 4)
#Access the elements using the numeric indices
print(p[0], p[1])
#Access the elements using their names
print(p.x, p.y)