i have some list of strings. I want to remove empty strings from the end of the list (i.e. each list should end with a non empty element).
input
list1= ['a1','b1','c1','d1','']
list2 = ['a2','','b2','','c2','d2','']
list3 = ['a3','','b3','','','']
list4 = ['','','','','']
output
list1= ['a1','b1','c1','d1']
list2 = ['a2','','b2','','c2','d2']
list3 = ['a3','','b3']
list4 = ['']
if all the elements are empty strings , only one empty string should remain (eg. list4).
-1, while trying to upcode, don't know why