Saturday, March 24, 2018

List append( ) Method


List append( ) Method


The append() method appends a passed obj into the existing list.

Syntax

list.append(obj)

Parameters
    obj - This is the object to be appended in the list.
Return Value
This method does not return any value but updates existing list.

Example
#!/usr/bin/python3

list1 = ['C++', 'Java', 'Python']
list1.append('C#')
print ("updated list : ", list1)

When we run the above program, it produces the following result

Updated list : ['C++', 'Java', 'Python', 'C#']



<<< list( ) method                 Go to Index                list.count( ) >>>