Python list() FunctionThe python list() creates a list in python. SignatureParametersiterable (optional) - An object that can be a sequence( string, tuple etc.) or collection( set, dictionary etc.) or iterator object. ReturnIt returns a list. Python list() Function Example 1The below example create a list from sequence: string, tuple and list. Output: [] ['a', 'b', 'c', 'd', 'e'] [1,2,3,4,5] [1,2,3,4,5] Explanation: The above example creates a list from sequence: string, tuple and list. Python list() Function Example 2The below example create list from collection: set and dictionary. Output: ['e', 'c', 'd', 'b', 'a'] ['c', 'e', 'd', 'b', 'a']
Next TopicPython Functions
|