Python List append() MethodPython Functions


The append() method is used to add a new object at the end of the list.

Example

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

list1 = ['MIT', 'CIT', 'Yale','UCI']
list1.append('NYU')
print ("The new list is: ", list1)

Output:

The new list is:  ['MIT', 'CIT', 'Yale', 'UCI', 'NYU']

Syntax

list.append(obj)

Parameters

Name Description
obj Object added to the end of the list.

Return Value

It doesn’t return any value.

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