insert - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Homework (https://python-forum.io/forum-9.html) +--- Thread: insert (/thread-12002.html) |
insert - mj125 - Aug-04-2018 hello, I'm a beginner at python and I run this code: x = [1,2,3,4] print("x= ",x) y = x.insert(1,6) print("y= ", y)and the answer is: why?
RE: insert - buran - Aug-04-2018 list.insert() method works in-place, e.g.my_list = [1, 2, 3, 4] my_list.insert(1, 6) print(my_list)
RE: insert - mj125 - Aug-04-2018 Thanks. |