Post

PythonPython

n
naveen nani

Posted on 24th April 2024|13 views

0
votes

Replace Element In List Python

How to replace elements of a list in python?

Answers
P
naseer mohammad

Posted on 24th April 2024

You can replace the elements of a list very easily like this 

Assume you have a list of numbers 

numbers = [1, 1, 3, 4, 5]

numbers[2] = 2

Output:

numbers = [1, 2, 3, 4, 5]

 

Write your answer

STILL GOT QUERIES?

Get a Live FREE Demo
  • Explore the trending and niche courses and learning maps
  • Learn about tuition fee, payment plans, and scholarships
  • Get access to webinars and self-paced learning videos