Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. **************************************************************** Personal firewall software may warn about the connection IDLE makes to its subprocess using this computer's internal loopback interface. This connection is not visible on any external interface and no data is sent to or received from the Internet. **************************************************************** IDLE 2.6.1 >>> .... SyntaxError: invalid syntax >>> >>> ;;;;;;;;;;; SyntaxError: invalid syntax >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> memeber = {'basketball':5, 'soccer':11, 'baseball' :9} >>> member Traceback (most recent call last): File "", line 1, in member NameError: name 'member' is not defined >>> member Traceback (most recent call last): File "", line 1, in member NameError: name 'member' is not defined >>> memeber {'soccer': 11, 'basketball': 5, 'baseball': 9} >>> >>> >>>memeber SyntaxError: invalid syntax >>> type(memeber) >>> memeber['soccer'] 11 >>> >>> memeber['volleyball'] = 6 >>> memeber {'soccer': 11, 'basketball': 5, 'baseball': 9, 'volleyball': 6} >>> memeber['volleyball']=2 >>> memeber {'soccer': 11, 'basketball': 5, 'baseball': 9, 'volleyball': 2} >>> del member['volleyball'] Traceback (most recent call last): File "", line 1, in del member['volleyball'] NameError: name 'member' is not defined >>> del memeber['volleyball'] >>> len memeber SyntaxError: invalid syntax >>> len(memeber) 3 >>> memeber {'soccer': 11, 'basketball': 5, 'baseball': 9} >>> memeber[1] = 100; >>> memeber {'soccer': 11, 'basketball': 5, 'baseball': 9, 1: 100} >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> memeber {'soccer': 11, 'basketball': 5, 'baseball': 9, 1: 100} >>> memeber {'soccer': 11, 'basketball': 5, 'baseball': 9, 1: 100} >>> memeber[(1,2,3)] = 6 >>> memeber {1: 100, 'basketball': 5, (1, 2, 3): 6, 'baseball': 9, 'soccer': 11} >>> memeber[[1,2,3]] =4 Traceback (most recent call last): File "", line 1, in memeber[[1,2,3]] =4 TypeError: unhashable type: 'list' >>> def add(a,b) SyntaxError: invalid syntax >>> def add(a,b): return a-b >>> add >>> sub Traceback (most recent call last): File "", line 1, in sub NameError: name 'sub' is not defined >>> def sub(a,b): return a-b >>> sub >>> add >>> sub >>> add >>> >>> add >>> sub >>> add(2,3) -1 >>> FT = {'add':add, 'sub':sub} >>> ft Traceback (most recent call last): File "", line 1, in ft NameError: name 'ft' is not defined >>> FT {'add': , 'sub': } >>> FT {'add': , 'sub': } >>> FT {'add': , 'sub': } >>> FT['add'] >>> FT['add'](3,4) -1 >>> FT['add'](3,4) -1 >>> FT['add'](3,4) -1 >>> FT['add'](3,4) -1 >>> >>> menu = {'apple':500, 'pear':2000, 'grape':1000} >>> menu {'grape': 1000, 'pear': 2000, 'apple': 500} >>> menu[ 'apple'] 500 >>> menu['apple'] 500 >>> menu[itme] Traceback (most recent call last): File "", line 1, in menu[itme] NameError: name 'itme' is not defined >>> menu[item] Traceback (most recent call last): File "", line 1, in menu[item] NameError: name 'item' is not defined >>> >>> >>> >>> >>> >>> >>> >>> item = 'apple' >>> menu[item] 500 >>> >>> >>> >>> >>> >>> >>> >>> ³× T_T ´äµµ ¾È³ª¿Â´Ù. SyntaxError: invalid syntax >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> ³­ ¢B¤·±ÞÀÌ³× SyntaxError: invalid syntax >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> item = 'orange' >>> menu[item] Traceback (most recent call last): File "", line 1, in menu[item] KeyError: 'orange' >>> menu.get('apple') 500 >>> menu {'grape': 1000, 'pear': 2000, 'apple': 500} >>> menu.get('appsdf') >>> menu.get('appsdf',-1) -1 >>> menu.get(item, 0) 0 >>> menu {'grape': 1000, 'pear': 2000, 'apple': 500} >>> menu.keys() ['grape', 'pear', 'apple'] >>> >>> menu.keys() ['grape', 'pear', 'apple'] >>> menu.values() [1000, 2000, 500] >>> >>> menu.values() [1000, 2000, 500] >>> >>> menu.keys() ['grape', 'pear', 'apple'] >>> menu.values() [1000, 2000, 500] >>> menu.items() [('grape', 1000), ('pear', 2000), ('apple', 500)] >>> menu {'grape': 1000, 'pear': 2000, 'apple': 500} >>> >>> menu.items() [('grape', 1000), ('pear', 2000), ('apple', 500)] >>> for key in menu.keys(): print key, menu[key] grape 1000 pear 2000 apple 500 >>> menu.keys() ['grape', 'pear', 'apple'] >>> >>> >>> menu.keys() ['grape', 'pear', 'apple'] >>> for key in menu.keys(): print key, menu[key] grape 1000 pear 2000 apple 500 >>> >>> >>> for key in menu(): print key, menu[key] Traceback (most recent call last): File "", line 1, in for key in menu(): TypeError: 'dict' object is not callable >>> for key in menu: print key, menu[key] grape 1000 pear 2000 apple 500 >>> for key in menu.values() print value SyntaxError: invalid syntax >>> >>> for key in menu.values: print value Traceback (most recent call last): File "", line 1, in for key in menu.values: TypeError: 'builtin_function_or_method' object is not iterable >>> for key in menu.values(): print value Traceback (most recent call last): File "", line 2, in print value NameError: name 'value' is not defined >>> for key in menu.values(): print value Traceback (most recent call last): File "", line 2, in print value NameError: name 'value' is not defined >>> for key in menu.values(): print key 1000 2000 500 >>> for key,value in menu.items(): print key,value grape 1000 pear 2000 apple 500 >>> menu {'grape': 1000, 'pear': 2000, 'apple': 500} >>> 'grape' in menu True >>> 'or' in munu Traceback (most recent call last): File "", line 1, in 'or' in munu NameError: name 'munu' is not defined >>> 'oror in menu SyntaxError: EOL while scanning string literal >>> 'oror in menu SyntaxError: EOL while scanning string literal >>> 'oror' in menu False >>> L = [1,2,3,4,5] >>> 3 in L True >>> s = 'pyhton rules' >>> 'th' in s False >>> 'ht' in s True >>> ' r' in s True >>> '' in s True >>> 'sdf' in s False >>> False False >>> clear() Traceback (most recent call last): File "", line 1, in clear() NameError: name 'clear' is not defined >>> >>> >>> >>> globals() {'FT': {'add': , 'sub': }, 'sub': , '__builtins__': , 'menu': {'grape': 1000, 'pear': 2000, 'apple': 500}, 'L': [1, 2, 3, 4, 5], 'value': 500, '__package__': None, 'item': 'orange', 'add': , 'key': 'apple', 'memeber': {1: 100, 'basketball': 5, (1, 2, 3): 6, 'baseball': 9, 'soccer': 11}, '__name__': '__main__', 's': 'pyhton rules', '__doc__': None} >>> >>> >>> globals() {'FT': {'add': , 'sub': }, 'sub': , '__builtins__': , 'menu': {'grape': 1000, 'pear': 2000, 'apple': 500}, 'L': [1, 2, 3, 4, 5], 'value': 500, '__package__': None, 'item': 'orange', 'add': , 'key': 'apple', 'memeber': {1: 100, 'basketball': 5, (1, 2, 3): 6, 'baseball': 9, 'soccer': 11}, '__name__': '__main__', 's': 'pyhton rules', '__doc__': None} >>> globals().items >>> globals() {'FT': {'add': , 'sub': }, 'sub': , '__builtins__': , 'menu': {'grape': 1000, 'pear': 2000, 'apple': 500}, 'L': [1, 2, 3, 4, 5], 'value': 500, '__package__': None, 'item': 'orange', 'add': , 'key': 'apple', 'memeber': {1: 100, 'basketball': 5, (1, 2, 3): 6, 'baseball': 9, 'soccer': 11}, '__name__': '__main__', 's': 'pyhton rules', '__doc__': None} >>> globals().get(FT) Traceback (most recent call last): File "", line 1, in globals().get(FT) TypeError: unhashable type: 'dict' >>> globals().get('FT') {'add': , 'sub': } >>> globals().get('FT') {'add': , 'sub': } >>> globals().get('FT')(1,2) Traceback (most recent call last): File "", line 1, in globals().get('FT')(1,2) TypeError: 'dict' object is not callable >>> FT {'add': , 'sub': } >>> globals().get('FT') {'add': , 'sub': } >>> FT {'add': , 'sub': } >>> FT.get('add') >>> FT.get('add')(1,2) -1 >>> FT.get('add')(1,2) -1 >>> FT.get('add')(5,2) 3 >>> locals(() ; SyntaxError: invalid syntax >>> locals() {'FT': {'add': , 'sub': }, 'sub': , '__builtins__': , 'menu': {'grape': 1000, 'pear': 2000, 'apple': 500}, 'L': [1, 2, 3, 4, 5], 'value': 500, '__package__': None, 'item': 'orange', 'add': , 'key': 'apple', 'memeber': {1: 100, 'basketball': 5, (1, 2, 3): 6, 'baseball': 9, 'soccer': 11}, '__name__': '__main__', 's': 'pyhton rules', '__doc__': None} >>> >>> def add(a,b): c = a + b print locals() return c >>> add(2,3) {'a': 2, 'c': 5, 'b': 3} 5 >>> globals() {'FT': {'add': , 'sub': }, 'sub': , '__builtins__': , 'menu': {'grape': 1000, 'pear': 2000, 'apple': 500}, 'L': [1, 2, 3, 4, 5], 'value': 500, '__package__': None, 'item': 'orange', 'add': , 'key': 'apple', 'memeber': {1: 100, 'basketball': 5, (1, 2, 3): 6, 'baseball': 9, 'soccer': 11}, '__name__': '__main__', 's': 'pyhton rules', '__doc__': None} >>> add(1,2) {'a': 1, 'c': 3, 'b': 2} 3 >>> add(1,2) {'a': 1, 'c': 3, 'b': 2} 3 >>> >>> >>> globals().keys() ['FT', 'sub', '__builtins__', 'menu', 'L', 'value', '__package__', 'item', 'add', 'key', 'memeber', '__name__', 's', '__doc__'] >>> globals().keys() ['FT', 'sub', '__builtins__', 'menu', 'L', 'value', '__package__', 'item', 'add', 'key', 'memeber', '__name__', 's', '__doc__'] >>> s 'pyhton rules' >>> add >>> globals()['add](3,4) SyntaxError: EOL while scanning string literal >>> globals()['add'](3,4) {'a': 3, 'c': 7, 'b': 4} 7 >>> >>> >>> set >>> in SyntaxError: invalid syntax >>> globlas Traceback (most recent call last): File "", line 1, in globlas NameError: name 'globlas' is not defined >>> >>> >>> set() set([]) >>> >>> >>> set([]) set([]) >>> >>> >>> set ( [1,2,34] ) set([1, 2, 34]) >>> a Traceback (most recent call last): File "", line 1, in a NameError: name 'a' is not defined >>> set >>> a = set([1, 2, 34]) >>> a set([1, 2, 34]) >>> b = set([1, 2, 3,4]) >>> a set([1, 2, 34]) b >>> >>> b set([1, 2, 3, 4]) >>> a set([1, 2, 34]) >>> b set([1, 2, 3, 4]) >>> a set([1, 2, 34]) b >>> >>> a.intersection(b) set([1, 2]) >>> a.symmetric_difference(b) set([34, 3, 4]) >>> a < b False >>> a set([1, 2, 34]) b >>> >>> b set([1, 2, 3, 4]) >>> a set([1, 2, 34]) >>> a set([1, 2, 34]) >>> b set([1, 2, 3, 4]) >>> c < b Traceback (most recent call last): File "", line 1, in c < b NameError: name 'c' is not defined >>> a < b False >>> a | b set([1, 2, 3, 4, 34]) >>> a & b set([1, 2]) >>> set([3,4]) set([3, 4]) >>> set([1,2,5,6]) set([1, 2, 5, 6]) >>> 3 in a False >>> 5 in a False >>> >>> a set([1, 2, 34]) >>> >>> >>> a set([1, 2, 34]) >>> >>> a.add(7) >>> a set([1, 2, 34, 7]) >>> a.remove(7) >>> a set([1, 2, 34]) >>> >>> >>> a set([1, 2, 34]) >>> s = """Python is a dynamic object-oriented programming language that can be used for many kinds of software development. It offers strong support for integration with other languages and tools, comes with extensive standard libraries, and can be learned in a few days. Many Python programmers report substantial productivity gains and feel the language encourages the development of higher quality, more maintainable code""" >>> s 'Python is a dynamic object-oriented programming language that can be used for many kinds of software development. It offers strong support for integration with other languages and tools, comes with extensive standard libraries, and can be learned in a few days. Many Python programmers report substantial productivity gains and feel the language encourages the development of higher quality, more maintainable code' >>> s 'Python is a dynamic object-oriented programming language that can be used for many kinds of software development. It offers strong support for integration with other languages and tools, comes with extensive standard libraries, and can be learned in a few days. Many Python programmers report substantial productivity gains and feel the language encourages the development of higher quality, more maintainable code' >>> s 'Python is a dynamic object-oriented programming language that can be used for many kinds of software development. It offers strong support for integration with other languages and tools, comes with extensive standard libraries, and can be learned in a few days. Many Python programmers report substantial productivity gains and feel the language encourages the development of higher quality, more maintainable code' >>> s.find(?) SyntaxError: invalid syntax >>> s.find('?') -1 >>> s.find(' ') -1 >>> s 'Python is a dynamic object-oriented programming language that can be used for many kinds of software development. It offers strong support for integration with other languages and tools, comes with extensive standard libraries, and can be learned in a few days. Many Python programmers report substantial productivity gains and feel the language encourages the development of higher quality, more maintainable code' >>> len(s) 414 >>> s 'Python is a dynamic object-oriented programming language that can be used for many kinds of software development. It offers strong support for integration with other languages and tools, comes with extensive standard libraries, and can be learned in a few days. Many Python programmers report substantial productivity gains and feel the language encourages the development of higher quality, more maintainable code' >>> g = s.split(" ") >>> g ['Python', 'is', 'a', 'dynamic', 'object-oriented', 'programming', 'language', 'that', 'can', 'be', 'used', 'for', 'many', 'kinds', 'of', 'software', 'development.', 'It', 'offers', 'strong', 'support', 'for', 'integration', 'with', 'other', 'languages', 'and', 'tools,', 'comes', 'with', 'extensive', 'standard', 'libraries,', 'and', 'can', 'be', 'learned', 'in', 'a', 'few', 'days.', 'Many', 'Python', 'programmers', 'report', 'substantial', 'productivity', 'gains', 'and', 'feel', 'the', 'language', 'encourages', 'the', 'development', 'of', 'higher', 'quality,', 'more', 'maintainable', 'code'] >>> g ['Python', 'is', 'a', 'dynamic', 'object-oriented', 'programming', 'language', 'that', 'can', 'be', 'used', 'for', 'many', 'kinds', 'of', 'software', 'development.', 'It', 'offers', 'strong', 'support', 'for', 'integration', 'with', 'other', 'languages', 'and', 'tools,', 'comes', 'with', 'extensive', 'standard', 'libraries,', 'and', 'can', 'be', 'learned', 'in', 'a', 'few', 'days.', 'Many', 'Python', 'programmers', 'report', 'substantial', 'productivity', 'gains', 'and', 'feel', 'the', 'language', 'encourages', 'the', 'development', 'of', 'higher', 'quality,', 'more', 'maintainable', 'code'] >>> g ['Python', 'is', 'a', 'dynamic', 'object-oriented', 'programming', 'language', 'that', 'can', 'be', 'used', 'for', 'many', 'kinds', 'of', 'software', 'development.', 'It', 'offers', 'strong', 'support', 'for', 'integration', 'with', 'other', 'languages', 'and', 'tools,', 'comes', 'with', 'extensive', 'standard', 'libraries,', 'and', 'can', 'be', 'learned', 'in', 'a', 'few', 'days.', 'Many', 'Python', 'programmers', 'report', 'substantial', 'productivity', 'gains', 'and', 'feel', 'the', 'language', 'encourages', 'the', 'development', 'of', 'higher', 'quality,', 'more', 'maintainable', 'code'] >>> s 'Python is a dynamic object-oriented programming language that can be used for many kinds of software development. It offers strong support for integration with other languages and tools, comes with extensive standard libraries, and can be learned in a few days. Many Python programmers report substantial productivity gains and feel the language encourages the development of higher quality, more maintainable code' >>> >>> g ['Python', 'is', 'a', 'dynamic', 'object-oriented', 'programming', 'language', 'that', 'can', 'be', 'used', 'for', 'many', 'kinds', 'of', 'software', 'development.', 'It', 'offers', 'strong', 'support', 'for', 'integration', 'with', 'other', 'languages', 'and', 'tools,', 'comes', 'with', 'extensive', 'standard', 'libraries,', 'and', 'can', 'be', 'learned', 'in', 'a', 'few', 'days.', 'Many', 'Python', 'programmers', 'report', 'substantial', 'productivity', 'gains', 'and', 'feel', 'the', 'language', 'encourages', 'the', 'development', 'of', 'higher', 'quality,', 'more', 'maintainable', 'code'] >>> len(g) 61 >>> set >>> set w SyntaxError: invalid syntax >>> ¸ÁÇß´Ù... SyntaxError: invalid syntax >>> >>> ;;; SyntaxError: invalid syntax >>> SyntaxError: invalid syntax SyntaxError: invalid syntax >>> g >>> >>> g ['Python', 'is', 'a', 'dynamic', 'object-oriented', 'programming', 'language', 'that', 'can', 'be', 'used', 'for', 'many', 'kinds', 'of', 'software', 'development.', 'It', 'offers', 'strong', 'support', 'for', 'integration', 'with', 'other', 'languages', 'and', 'tools,', 'comes', 'with', 'extensive', 'standard', 'libraries,', 'and', 'can', 'be', 'learned', 'in', 'a', 'few', 'days.', 'Many', 'Python', 'programmers', 'report', 'substantial', 'productivity', 'gains', 'and', 'feel', 'the', 'language', 'encourages', 'the', 'development', 'of', 'higher', 'quality,', 'more', 'maintainable', 'code'] >>> g ['Python', 'is', 'a', 'dynamic', 'object-oriented', 'programming', 'language', 'that', 'can', 'be', 'used', 'for', 'many', 'kinds', 'of', 'software', 'development.', 'It', 'offers', 'strong', 'support', 'for', 'integration', 'with', 'other', 'languages', 'and', 'tools,', 'comes', 'with', 'extensive', 'standard', 'libraries,', 'and', 'can', 'be', 'learned', 'in', 'a', 'few', 'days.', 'Many', 'Python', 'programmers', 'report', 'substantial', 'productivity', 'gains', 'and', 'feel', 'the', 'language', 'encourages', 'the', 'development', 'of', 'higher', 'quality,', 'more', 'maintainable', 'code'] >>> set = [(g)] >>> set [['Python', 'is', 'a', 'dynamic', 'object-oriented', 'programming', 'language', 'that', 'can', 'be', 'used', 'for', 'many', 'kinds', 'of', 'software', 'development.', 'It', 'offers', 'strong', 'support', 'for', 'integration', 'with', 'other', 'languages', 'and', 'tools,', 'comes', 'with', 'extensive', 'standard', 'libraries,', 'and', 'can', 'be', 'learned', 'in', 'a', 'few', 'days.', 'Many', 'Python', 'programmers', 'report', 'substantial', 'productivity', 'gains', 'and', 'feel', 'the', 'language', 'encourages', 'the', 'development', 'of', 'higher', 'quality,', 'more', 'maintainable', 'code']] >>> >>> gg = [(g)] >>> gg [['Python', 'is', 'a', 'dynamic', 'object-oriented', 'programming', 'language', 'that', 'can', 'be', 'used', 'for', 'many', 'kinds', 'of', 'software', 'development.', 'It', 'offers', 'strong', 'support', 'for', 'integration', 'with', 'other', 'languages', 'and', 'tools,', 'comes', 'with', 'extensive', 'standard', 'libraries,', 'and', 'can', 'be', 'learned', 'in', 'a', 'few', 'days.', 'Many', 'Python', 'programmers', 'report', 'substantial', 'productivity', 'gains', 'and', 'feel', 'the', 'language', 'encourages', 'the', 'development', 'of', 'higher', 'quality,', 'more', 'maintainable', 'code']] >>> >>> g ['Python', 'is', 'a', 'dynamic', 'object-oriented', 'programming', 'language', 'that', 'can', 'be', 'used', 'for', 'many', 'kinds', 'of', 'software', 'development.', 'It', 'offers', 'strong', 'support', 'for', 'integration', 'with', 'other', 'languages', 'and', 'tools,', 'comes', 'with', 'extensive', 'standard', 'libraries,', 'and', 'can', 'be', 'learned', 'in', 'a', 'few', 'days.', 'Many', 'Python', 'programmers', 'report', 'substantial', 'productivity', 'gains', 'and', 'feel', 'the', 'language', 'encourages', 'the', 'development', 'of', 'higher', 'quality,', 'more', 'maintainable', 'code'] >>> g.count >>> >>> g ['Python', 'is', 'a', 'dynamic', 'object-oriented', 'programming', 'language', 'that', 'can', 'be', 'used', 'for', 'many', 'kinds', 'of', 'software', 'development.', 'It', 'offers', 'strong', 'support', 'for', 'integration', 'with', 'other', 'languages', 'and', 'tools,', 'comes', 'with', 'extensive', 'standard', 'libraries,', 'and', 'can', 'be', 'learned', 'in', 'a', 'few', 'days.', 'Many', 'Python', 'programmers', 'report', 'substantial', 'productivity', 'gains', 'and', 'feel', 'the', 'language', 'encourages', 'the', 'development', 'of', 'higher', 'quality,', 'more', 'maintainable', 'code'] >>> s 'Python is a dynamic object-oriented programming language that can be used for many kinds of software development. It offers strong support for integration with other languages and tools, comes with extensive standard libraries, and can be learned in a few days. Many Python programmers report substantial productivity gains and feel the language encourages the development of higher quality, more maintainable code' >>> s 'Python is a dynamic object-oriented programming language that can be used for many kinds of software development. It offers strong support for integration with other languages and tools, comes with extensive standard libraries, and can be learned in a few days. Many Python programmers report substantial productivity gains and feel the language encourages the development of higher quality, more maintainable code' s >>> . >>> >>> s 'Python is a dynamic object-oriented programming language that can be used for many kinds of software development. It offers strong support for integration with other languages and tools, comes with extensive standard libraries, and can be learned in a few days. Many Python programmers report substantial productivity gains and feel the language encourages the development of higher quality, more maintainable code' >>> ok = set([s]) Traceback (most recent call last): File "", line 1, in ok = set([s]) TypeError: 'list' object is not callable >>> ok = set(s) Traceback (most recent call last): File "", line 1, in ok = set(s) TypeError: 'list' object is not callable >>> a = set([1, 2, 34]) Traceback (most recent call last): File "", line 1, in a = set([1, 2, 34]) TypeError: 'list' object is not callable a >>> >>> a set([1, 2, 34]) >>> s 'Python is a dynamic object-oriented programming language that can be used for many kinds of software development. It offers strong support for integration with other languages and tools, comes with extensive standard libraries, and can be learned in a few days. Many Python programmers report substantial productivity gains and feel the language encourages the development of higher quality, more maintainable code' >>> g ['Python', 'is', 'a', 'dynamic', 'object-oriented', 'programming', 'language', 'that', 'can', 'be', 'used', 'for', 'many', 'kinds', 'of', 'software', 'development.', 'It', 'offers', 'strong', 'support', 'for', 'integration', 'with', 'other', 'languages', 'and', 'tools,', 'comes', 'with', 'extensive', 'standard', 'libraries,', 'and', 'can', 'be', 'learned', 'in', 'a', 'few', 'days.', 'Many', 'Python', 'programmers', 'report', 'substantial', 'productivity', 'gains', 'and', 'feel', 'the', 'language', 'encourages', 'the', 'development', 'of', 'higher', 'quality,', 'more', 'maintainable', 'code'] >>> s 'Python is a dynamic object-oriented programming language that can be used for many kinds of software development. It offers strong support for integration with other languages and tools, comes with extensive standard libraries, and can be learned in a few days. Many Python programmers report substantial productivity gains and feel the language encourages the development of higher quality, more maintainable code' >>> g ['Python', 'is', 'a', 'dynamic', 'object-oriented', 'programming', 'language', 'that', 'can', 'be', 'used', 'for', 'many', 'kinds', 'of', 'software', 'development.', 'It', 'offers', 'strong', 'support', 'for', 'integration', 'with', 'other', 'languages', 'and', 'tools,', 'comes', 'with', 'extensive', 'standard', 'libraries,', 'and', 'can', 'be', 'learned', 'in', 'a', 'few', 'days.', 'Many', 'Python', 'programmers', 'report', 'substantial', 'productivity', 'gains', 'and', 'feel', 'the', 'language', 'encourages', 'the', 'development', 'of', 'higher', 'quality,', 'more', 'maintainable', 'code'] >>> test = {g} SyntaxError: invalid syntax >>> menu = {'apple':500, 'pear':2000, 'grape':1000} >>> >>> g ['Python', 'is', 'a', 'dynamic', 'object-oriented', 'programming', 'language', 'that', 'can', 'be', 'used', 'for', 'many', 'kinds', 'of', 'software', 'development.', 'It', 'offers', 'strong', 'support', 'for', 'integration', 'with', 'other', 'languages', 'and', 'tools,', 'comes', 'with', 'extensive', 'standard', 'libraries,', 'and', 'can', 'be', 'learned', 'in', 'a', 'few', 'days.', 'Many', 'Python', 'programmers', 'report', 'substantial', 'productivity', 'gains', 'and', 'feel', 'the', 'language', 'encourages', 'the', 'development', 'of', 'higher', 'quality,', 'more', 'maintainable', 'code'] >>> menu ={g} SyntaxError: invalid syntax >>> menu = g >>> menu ['Python', 'is', 'a', 'dynamic', 'object-oriented', 'programming', 'language', 'that', 'can', 'be', 'used', 'for', 'many', 'kinds', 'of', 'software', 'development.', 'It', 'offers', 'strong', 'support', 'for', 'integration', 'with', 'other', 'languages', 'and', 'tools,', 'comes', 'with', 'extensive', 'standard', 'libraries,', 'and', 'can', 'be', 'learned', 'in', 'a', 'few', 'days.', 'Many', 'Python', 'programmers', 'report', 'substantial', 'productivity', 'gains', 'and', 'feel', 'the', 'language', 'encourages', 'the', 'development', 'of', 'higher', 'quality,', 'more', 'maintainable', 'code'] >>> {} {} >>> text = set(s.split(' ') ; SyntaxError: invalid syntax >>> text = set(s.split(' ')) Traceback (most recent call last): File "", line 1, in text = set(s.split(' ')) TypeError: 'list' object is not callable >>> text = set(s.split(' ')) Traceback (most recent call last): File "", line 1, in text = set(s.split(' ')) TypeError: 'list' object is not callable >>> text Traceback (most recent call last): File "", line 1, in text NameError: name 'text' is not defined >>> A Traceback (most recent call last): File "", line 1, in A NameError: name 'A' is not defined >>> a set([1, 2, 34]) >>> a = set(s.split(' ")) SyntaxError: EOL while scanning string literal >>> set(s.split(' ")) SyntaxError: EOL while scanning string literal >>> set(s.split(' ')) Traceback (most recent call last): File "", line 1, in set(s.split(' ')) TypeError: 'list' object is not callable >>> s 'Python is a dynamic object-oriented programming language that can be used for many kinds of software development. It offers strong support for integration with other languages and tools, comes with extensive standard libraries, and can be learned in a few days. Many Python programmers report substantial productivity gains and feel the language encourages the development of higher quality, more maintainable code' >>> s.split('') Traceback (most recent call last): File "", line 1, in s.split('') ValueError: empty separator >>> s.split(' ') ['Python', 'is', 'a', 'dynamic', 'object-oriented', 'programming', 'language', 'that', 'can', 'be', 'used', 'for', 'many', 'kinds', 'of', 'software', 'development.', 'It', 'offers', 'strong', 'support', 'for', 'integration', 'with', 'other', 'languages', 'and', 'tools,', 'comes', 'with', 'extensive', 'standard', 'libraries,', 'and', 'can', 'be', 'learned', 'in', 'a', 'few', 'days.', 'Many', 'Python', 'programmers', 'report', 'substantial', 'productivity', 'gains', 'and', 'feel', 'the', 'language', 'encourages', 'the', 'development', 'of', 'higher', 'quality,', 'more', 'maintainable', 'code'] >>> set(s.split(' ')) Traceback (most recent call last): File "", line 1, in set(s.split(' ')) TypeError: 'list' object is not callable >>> word_set = set(s.split()) Traceback (most recent call last): File "", line 1, in word_set = set(s.split()) TypeError: 'list' object is not callable >>> wordset = set(s.lower().split()) Traceback (most recent call last): File "", line 1, in wordset = set(s.lower().split()) TypeError: 'list' object is not callable >>> >>> >>> >>> >>> >>> memeber = {} >>> member Traceback (most recent call last): File "", line 1, in member NameError: name 'member' is not defined >>> >>> word Traceback (most recent call last): File "", line 1, in word NameError: name 'word' is not defined >>> word Traceback (most recent call last): File "", line 1, in word NameError: name 'word' is not defined >>> wordset Traceback (most recent call last): File "", line 1, in wordset NameError: name 'wordset' is not defined >>> word Traceback (most recent call last): File "", line 1, in word NameError: name 'word' is not defined >>> s 'Python is a dynamic object-oriented programming language that can be used for many kinds of software development. It offers strong support for integration with other languages and tools, comes with extensive standard libraries, and can be learned in a few days. Many Python programmers report substantial productivity gains and feel the language encourages the development of higher quality, more maintainable code' >>> wordset = set(s.lower().split()) Traceback (most recent call last): File "", line 1, in wordset = set(s.lower().split()) TypeError: 'list' object is not callable >>> wordset = set(s.lower().split()) Traceback (most recent call last): File "", line 1, in wordset = set(s.lower().split()) TypeError: 'list' object is not callable >>> del wordset Traceback (most recent call last): File "", line 1, in del wordset NameError: name 'wordset' is not defined >>> wordset = set(s.lower().split()) Traceback (most recent call last): File "", line 1, in wordset = set(s.lower().split()) TypeError: 'list' object is not callable >>> s 'Python is a dynamic object-oriented programming language that can be used for many kinds of software development. It offers strong support for integration with other languages and tools, comes with extensive standard libraries, and can be learned in a few days. Many Python programmers report substantial productivity gains and feel the language encourages the development of higher quality, more maintainable code' >>> s.lower().split() ['python', 'is', 'a', 'dynamic', 'object-oriented', 'programming', 'language', 'that', 'can', 'be', 'used', 'for', 'many', 'kinds', 'of', 'software', 'development.', 'it', 'offers', 'strong', 'support', 'for', 'integration', 'with', 'other', 'languages', 'and', 'tools,', 'comes', 'with', 'extensive', 'standard', 'libraries,', 'and', 'can', 'be', 'learned', 'in', 'a', 'few', 'days.', 'many', 'python', 'programmers', 'report', 'substantial', 'productivity', 'gains', 'and', 'feel', 'the', 'language', 'encourages', 'the', 'development', 'of', 'higher', 'quality,', 'more', 'maintainable', 'code'] >>> set(s.lower().split()) Traceback (most recent call last): File "", line 1, in set(s.lower().split()) TypeError: 'list' object is not callable >>> set [['Python', 'is', 'a', 'dynamic', 'object-oriented', 'programming', 'language', 'that', 'can', 'be', 'used', 'for', 'many', 'kinds', 'of', 'software', 'development.', 'It', 'offers', 'strong', 'support', 'for', 'integration', 'with', 'other', 'languages', 'and', 'tools,', 'comes', 'with', 'extensive', 'standard', 'libraries,', 'and', 'can', 'be', 'learned', 'in', 'a', 'few', 'days.', 'Many', 'Python', 'programmers', 'report', 'substantial', 'productivity', 'gains', 'and', 'feel', 'the', 'language', 'encourages', 'the', 'development', 'of', 'higher', 'quality,', 'more', 'maintainable', 'code']] >>> del set >>> wordset = set(s.lower().split()) >>> wordset set(['and', 'development.', 'feel', 'is', 'dynamic', 'it', 'substantial', 'programmers', 'in', 'code', 'tools,', 'productivity', 'for', 'support', 'integration', 'languages', 'few', 'offers', 'quality,', 'extensive', 'higher', 'development', 'be', 'used', 'kinds', 'gains', 'that', 'python', 'libraries,', 'standard', 'days.', 'report', 'encourages', 'strong', 'with', 'learned', 'a', 'language', 'maintainable', 'of', 'programming', 'object-oriented', 'can', 'many', 'the', 'more', 'other', 'comes', 'software']) >>> wordset set(['and', 'development.', 'feel', 'is', 'dynamic', 'it', 'substantial', 'programmers', 'in', 'code', 'tools,', 'productivity', 'for', 'support', 'integration', 'languages', 'few', 'offers', 'quality,', 'extensive', 'higher', 'development', 'be', 'used', 'kinds', 'gains', 'that', 'python', 'libraries,', 'standard', 'days.', 'report', 'encourages', 'strong', 'with', 'learned', 'a', 'language', 'maintainable', 'of', 'programming', 'object-oriented', 'can', 'many', 'the', 'more', 'other', 'comes', 'software']) >>> len(wordset) 49 >>> word Traceback (most recent call last): File "", line 1, in word NameError: name 'word' is not defined >>> >>> member Traceback (most recent call last): File "", line 1, in member NameError: name 'member' is not defined >>> word_count = [] >>> memeber[word] = memeber[word] + 1word_count = [] SyntaxError: invalid syntax >>> >>> for word in s.lower().split(): if word in member: member[word] = member[word] +1 else: memeber[word] = 1 Traceback (most recent call last): File "", line 2, in if word in member: NameError: name 'member' is not defined >>> member Traceback (most recent call last): File "", line 1, in member NameError: name 'member' is not defined >>> del member Traceback (most recent call last): File "", line 1, in del member NameError: name 'member' is not defined >>> memeber = {} >>> for word in s.lower().split(): memeber[word] = memeber.get(word,0) +1 >>> memeber {'and': 3, 'development.': 1, 'feel': 1, 'is': 1, 'dynamic': 1, 'it': 1, 'substantial': 1, 'programmers': 1, 'in': 1, 'code': 1, 'tools,': 1, 'productivity': 1, 'for': 2, 'support': 1, 'integration': 1, 'languages': 1, 'few': 1, 'offers': 1, 'quality,': 1, 'extensive': 1, 'higher': 1, 'development': 1, 'be': 2, 'used': 1, 'kinds': 1, 'gains': 1, 'that': 1, 'python': 2, 'libraries,': 1, 'standard': 1, 'days.': 1, 'report': 1, 'encourages': 1, 'strong': 1, 'with': 2, 'learned': 1, 'a': 2, 'language': 2, 'maintainable': 1, 'of': 2, 'programming': 1, 'object-oriented': 1, 'can': 2, 'many': 2, 'the': 2, 'more': 1, 'other': 1, 'comes': 1, 'software': 1} >>> memeber {'and': 3, 'development.': 1, 'feel': 1, 'is': 1, 'dynamic': 1, 'it': 1, 'substantial': 1, 'programmers': 1, 'in': 1, 'code': 1, 'tools,': 1, 'productivity': 1, 'for': 2, 'support': 1, 'integration': 1, 'languages': 1, 'few': 1, 'offers': 1, 'quality,': 1, 'extensive': 1, 'higher': 1, 'development': 1, 'be': 2, 'used': 1, 'kinds': 1, 'gains': 1, 'that': 1, 'python': 2, 'libraries,': 1, 'standard': 1, 'days.': 1, 'report': 1, 'encourages': 1, 'strong': 1, 'with': 2, 'learned': 1, 'a': 2, 'language': 2, 'maintainable': 1, 'of': 2, 'programming': 1, 'object-oriented': 1, 'can': 2, 'many': 2, 'the': 2, 'more': 1, 'other': 1, 'comes': 1, 'software': 1} >>>