Im trying to get the last element in each nested list
such as

double list = [['Hello','how','are','you'],['I','am','fine'],['How','about','yourself']]
so that it will print out

I am also trying to do this all under a function such as

def last_words():
#where my double_list is already in this function

Thank you!

print( [x[-1] for x in double_list] )
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.