Try to search your question here, if you can't find : Ask Any Question Now ?

How to remove last item of a list/array no matter the length (closed)

HomeCategory: stackoverflowHow to remove last item of a list/array no matter the length (closed)
pushpa asked 1 week ago

I am trying to remove the last item of a list/array even if there are duplicate items
EG

list = ["h","e","l","l","o"," ","t","h","e","r,"e"]

It would remove the final "e" but not the second and ninth "e"

I have already tried

finalSentence.remove([finalSentence[len(finalSentence)-1]])

However this removes a random letter, I know this is because it is removing a letter rather than item number and python does not know which one to choose so it is a random one that is removed. But I do not know another way to get this to work

1 Answers
Best Answer
Fernando answered 1 week ago
Your Answer

15 + 0 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com