Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. input_list = [121, 23, 3, 333, 4]
  2. input_list.sort(reverse=True)
  3. print input_list
  4.  
  5. temp_list1 = []
  6. max_sum = 0
  7.  
  8. for i in input_list:
  9. num = i
  10. flag = 'Y'
  11. temp_list2 = []
  12. x = -1
  13. y = -1
  14. while x != 0:
  15. x = i / 10
  16. y = i % 10
  17. i = x
  18. if y in temp_list1:
  19. flag = 'N'
  20. break
  21. else:
  22. temp_list2.append(y)
  23.  
  24. if flag == 'Y':
  25. temp_list1 = temp_list1 + temp_list2
  26. max_sum = max_sum + num
  27.  
  28. print max_sum
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement