Python Program to Change Element of a List



In this example we will learn how to change the element of List



  1. #Change element of a specific index in a list
  2. list = ['1', '2', '3', '4', '5']
  3. print(list)
  4. #Let's Change element of index 2 to '9'
  5. list[2] = '9'
  6. #Now print the new list
  7. print(list)

Output
Output!




codesadda.com

Codesadda.com is your home of programming solutions, tutorials, video tutorials and much more. Sign Up for our weekly newsletter to get update about new content.

Like us on Facebook | Connect with us on LinkedIn | Subscribe our Channel on Youtube