logo-MindMajix
PostPythonPython
J
James ROBERT

Posted on 13th June 2024|18 views

0
votes

Python List Prepend

How to prepend a list in python?

1 answers
Answers
P
Surya kumar

Posted on 13th June 2024| views

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
Name
Course *
Email *
Phone Number