Post

PythonPython

J
James ROBERT

Posted on 27th February 2024|14 views

0
votes

Python List Prepend

How to prepend a list in python?

Answers
P
Surya kumar

Posted on 27th February 2024

Prepending to a list means adding an element to the inception of the list, for example, prepending 5 to [6, 7] results in [5. 6, 7]

Here is the example 

Li1 = [6, 7]

Li1.insert = (0, 5)

print(Li1)

Output:

[5, 6, 7]

 

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