题解 | #提取不重复的整数#
提取不重复的整数
https://www.nowcoder.com/practice/253986e66d114d378ae8de2e6c4577c1
while True: try: int_numbers = list(str(input())) reverse_int_numbers = int_numbers[::-1] new_list = [] a = '' for i in reverse_int_numbers: if i in new_list: continue else: new_list.append(i) a += str(i) print(a) except: break
先将其变为一个列表,然后将列表反序,然后直接用if判断