def number_of_cases(list_data):
result = []
for i in list_data:
for j in list_data:
result.append(str(i) + str(j))
return result
print(number_of_cases(['a', 'b', '1', '2']))
Whatever I input as the list_data
argument, I want to get a deduplicated list of number of cases. But when the argument is ['a', 'a']
, I get ['aa', 'aa', 'aa', 'aa']
, not ['aa']
. How do I remove duplicated elements in a list while preserving their order using list_data.count() (because this is homework)?