>>> >>> for i in range(3): ... print(i) ... 0 1 2 >>> for i in [10, 7, 9]: ... print(i) ... 10 7 9 >>> for num in [10, 7, 9]: ... print(num) ... 10 7 9 >>> 7 in [10, 7, 9] True >>> 8 in [10, 7, 9] False >>> >>> greetings = ["hi","hello","how are you"] >>> "hi" in greetings True >>> "hi!" in greetings False >>> >>> ninja = "Tristan" >>> ninja_lst = ["Tristan","Zach"] >>> if ninja in ninja_lst: ... print("here!") ... here! >>> if "hello" in ninja_lst: ... print("here!") ... >>> >>> word = "swarthmore" >>> >>> for ch in word: ... print(ch) ... s w a r t h m o r e >>> >>> >>> for ninja in ninja_lst: ... print(ninja) ... Tristan Zach >>> >>> >>> word[0] 's' >>> word[2 ... ] 'a' >>> word[8] 'r' >>> >>> word[1:5] # 5-1=4 chars long 'wart' >>> word[6:10] # 10-6=4 chars long, does not include 10th char 'more' >>> >>> word[6:] # go all the way to the end 'more' >>> word[:5] # start from beginning 'swart' >>> >>> word[-1] # last character 'e' >>>