Hi,
Thanks for stack exchange link. I found that *list1[:1] returns, 4 but list1[:1] returns [4]. One is array (or list) containing 4 but other is only value 4.
So we can use both the answers. Any comments?
Zulfi.
Hi @Zulfi6000, if you want a list containing only the last element you need to add a colon like list1[-1:] – meaning a slice from the last element to the end of the list.