Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- input_list = [121, 23, 3, 333, 4]
- input_list.sort(reverse=True)
- print input_list
- temp_list1 = []
- max_sum = 0
- for i in input_list:
- num = i
- flag = 'Y'
- temp_list2 = []
- x = -1
- y = -1
- while x != 0:
- x = i / 10
- y = i % 10
- i = x
- if y in temp_list1:
- flag = 'N'
- break
- else:
- temp_list2.append(y)
- if flag == 'Y':
- temp_list1 = temp_list1 + temp_list2
- max_sum = max_sum + num
- print max_sum
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement