0

As title, I have a list and I want to find the element that appear twice.

For instance, a = [1,2,3,3,4] and I want to get "3".

I came up with a for loop using list.count(element)==2 to get the number but it's quit time wasting. Is there other ways without using for loop?

thanks a lot

Lee Tom
  • 93
  • 9
  • Thanks!! Do I have to delete this post? – Lee Tom Jul 21 '17 at 16:37
  • You don't have to delete this post, it's not a bad thing to have a dup, all we care about is linking them so that future users will be able to find the answer through your question. BTW I added an answer there: https://stackoverflow.com/a/45242753/1057429 which you might find useful. – Nir Alfasi Jul 21 '17 at 16:46
  • Really appreciate it – Lee Tom Jul 21 '17 at 16:48

0 Answers0