<div dir="ltr"><b>Why  does  .reverse(0 not work as a list method on line 5<br></b><div>Your code assumes the list.reverse() method returns a reversed list, but in fact the method reverses the list variable in-place and does not return anything. So, to print a reversed list, instead do:</div><blockquote style="margin:0 0 0 40px;border:none;padding:0px">list1.reverse()<br>print(list1)<br><br></blockquote><blockquote style="margin:0 0 0 40px;border:none;padding:0px"></blockquote><b>and then [not work] as a stand alone function on  line 7 ?<br></b>There is no built-in Python function called reverse(). There is the list.reverse() method set out above, and there is the reversed() builtin function, which returns a reversed iterator. You could use reversed() like so:<blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>print(list(reversed(list1)))</div></blockquote><div><div><br></div><div>More info: <a href="https://dbader.org/blog/python-reverse-list">https://dbader.org/blog/python-reverse-list</a></div><div><br></div><div>Have fun with Python!<br><font color="#888888"><div><div dir="ltr"></div></div></font><div><br></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, 11 Apr 2021 at 16:40, Andrew Smith <<a href="mailto:asmith9983@gmail.com">asmith9983@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Guys<div>I have a Raspberry Pi and  after some thought, decided I should learn Python as it's the  language most used in projects around it,and also in data science. </div><div>Knowing C++, and Haskell, I thought it would be simple. <i>Hello World</i>  was no problem, but lists have been less so.</div><div><br></div><div>I've attached my test code.  I Had to comment out lines 5 & 6 to get any output. </div><div>Why  does  .reverse(0 not work as a list method on line 5, and then as a stand alone function on  line 7 ?<br clear="all"><div><div dir="ltr"><div dir="ltr">Andrew</div></div></div></div></div>
-- <br>
EdLUG mailing list<br>
<a href="mailto:EdLUG@mailman.lug.org.uk" target="_blank">EdLUG@mailman.lug.org.uk</a><br>
<a href="https://lists.edlug.org.uk/mailman/listinfo/edlug" rel="noreferrer" target="_blank">https://lists.edlug.org.uk/mailman/listinfo/edlug</a></blockquote></div>