How to remove numbers with repeating digits from a list in Python

1 Answer

0 votes
lst = [3931, 812, 991, 7878, 49812, 3882, 6757, 31]
 
lst = [num for num in lst if len(set(str(num))) == len(str(num))]
 
print(lst)



'''
run:

[812, 49812, 31]

'''

 



answered Sep 24, 2023 by avibootz
...