Aug-11-2018, 01:28 PM
(This post was last modified: Aug-11-2018, 01:29 PM by Gribouillis.)
You can make this a little shorter
odds, even = eo = [set(), set()] with open('shakespeare.txt') as f: for index, row in enumerate(f): eo[index % 2].update(row.strip().split())Observe that python numbers lines from 0 while common CS and programming literature and software starts line counts at 1.