I'm trying to append a number to a list only when
i > 5 and an empty string when it has no number greater than 5.
My problem is trying to append for the number of times equal to a single empty string and according to the first for loop
for i in range(0,10)
This is what I've tried:
my_list =  for i in range(0,10): for j in range (0,5): if i > 5: my_list.append(i) else: my_list.append('')
But I am getting the empty strings looping over both for-loops and I'm a bit confused on how to proceed.
The output should be a list with a total of 10 elements as:
output = ['', '', '', '', '', '', 6, 7, 8, 9]
Second example as the one above may have over-simplified things:
file_names_short = ['apple pie', 'apple cake', 'carrot apple', 'carrot cake']
threshold = 0.70 result_list =  for x in file_names_short: for y in company_list: if similar(x, y) > threshold: result = x result_list.append(result) else: result_list.append('')
Which explains why it is necessary to have the second loop.