- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How we can update a Python list element value?
Python list object is mutable. Hence it is possible to update the list object.
To update list, assign new value to any item by using it access. For example, if you want to set 4th item (index counting from 0) to double its earlier value,
>>> L1 [10, 50, 20, 9, 40, 100, 60, 30, 1, 56] >>> L1[4]=L1[4]*2 >>> L1 [10, 50, 20, 9, 80, 100, 60, 30, 1, 56]
Item at 4th index has changed from 40 to 80.
- Related Articles
- How we can update a Python tuple element value?
- How can we update any value in MySQL view as we can update the values in MySQL table?
- Update each element in tuple list in Python
- How can we update a record in MongoDB?
- How we can iterate through a Python list of tuples?
- How can we update values in a MySQL table?
- How to find the element from a Python list with a maximum value?
- How to find the element from a Python list with a minimum value?
- How can we update columns values on multiple rows with a single MySQL UPDATE statement?
- Program to check we can update a list index by its current sum to reach target or not in python
- How can we convert a list of characters into a string in Python?
- Program to find index, where we can insert element to keep list sorted in Python
- Update a list of tuples using another list in Python
- Can we update MySQL with if condition?
- How can I remove the same element in the list by Python

Advertisements