Python List Construct MethodPython Functions

Difficulty Level:
Difficulty Level:

The list() function creates a list object which is ordered and mutable.

Example

#!/usr/bin/python3
# -*- coding: UTF-8 -*-

Tuple1 = (2019, 'Google', 'MIT', 'UCI')
list1 = list(Tuple1)
print(list1)

str1="ABCDEF"
list2=list(str1)
print(list2)

Output:

[2019, 'Google', 'MIT', 'UCI']
['A', 'B', 'C', 'D', 'E', 'F']

Syntax

list(obejct)

Parameters

Name Description
object A sequence, collection, or an iterator object.

Return Value

It returns a list object.

Advertisement

© 2021 Pythonexample.org, all rights reserved. Privacy Policy | Contact Us