def exactlyTwo(l):
for i in xrange(0, len(l)):
try:
j = l.index(l[i], i + 1)
try:
l.index(l[i], j + 1)
except ValueError:
return True
except ValueError:
# Do nothing. Not sure how to do that in Python.
0
return False
print exactlyTwo(["one", "one", "two"])
print exactlyTwo(["one", "two", "two"])
print exactlyTwo(["one", "two", "three"])