Print gives none - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Print gives none (/thread-27615.html) |
Print gives none - mariolucas75 - Jun-13-2020 Dear forum, Could you pls advise why this code gives none list=["a","b"] print(list.append(list[1]))And the following code works fine: list=["a","b"] list.append(list[1]) print(list) RE: Print gives none - buran - Jun-13-2020 list.append() method works in-place, i.e. it does not return the modified list as you expect. It returns None , like any other function that does not return something explicitly.By the way list is built-in function. don't use it as variable name
|