1. check if the list is empty or not
list1 = [' ',' ',' ',' ',' ',' ',' ',' ',' ']
def check_emptystring(list1)
for i in range(len(list1)):
if list1[i] == ' ':
print('list is not full')
2. make a new list "list2" as the list of indexes that are empty strings of list1 and send input A one by one. for example,after filling list1 with A's
list1 = ['A','A','','A','','','','A','']
now I've to create a new list "list2" as the indexes of empty strings in list1, so:
list2=[3,5,6,7,9]
def get_empytlist1(list1): list2 = [] for i in range(len(list1)): if list1[i] == ' ': list2.append(i) return list2
now I've to fill at these empty indexes of list1 with A's one by one. How can i do it???

New Topic/Question
Reply




MultiQuote




|