Write Python code to demonstrate Kth Non-None String from Rear using filter()
Topic: Write Python code to demonstrate Kth Non-None String from Rear using filter()
Solution
test_list = ["", "", "Akshat", "Nikhil"] print("The original list : " + str(test_list)) K = 2 res = list (filter(None, test_list))[-K] print("The Kth non empty string from rear is : " + str(res))
List all Python Programs