x = "the exam is looming on Thursday".split() print x ['the', 'exam', 'is', 'looming', 'on', 'Thursday'] for (index,word) in enumerate(x): if "i" in word: print "first i ", index first i 2 first i 3 for index in range(len(x)): if "i" in x[index]: print "first i", index first i 2 first i 3 y = [ [3, 4, 5, 6], [3, 5], [6,7]] print set(y) Traceback (most recent call last): File "C:\Users\Susan\AppData\Local\Enthought\Canopy\App\appdata\canopy-2.1.3.3542.win-x86_64\lib\site-packages\IPython\core\interactiveshell.py", line 2885, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 1, in print set(y) TypeError: unhashable type: 'list' y = set(4,5,6,7) Traceback (most recent call last): File "C:\Users\Susan\AppData\Local\Enthought\Canopy\App\appdata\canopy-2.1.3.3542.win-x86_64\lib\site-packages\IPython\core\interactiveshell.py", line 2885, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 1, in y = set(4,5,6,7) TypeError: set expected at most 1 arguments, got 4 y = set([4,5,6,7,4,5]) print y set([4, 5, 6, 7])