Skip to content

Instantly share code, notes, and snippets.

@lauromoura
Created November 7, 2011 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lauromoura/1344961 to your computer and use it in GitHub Desktop.
Save lauromoura/1344961 to your computer and use it in GitHub Desktop.
Quiz de listas do pug-pe challenge
import unittest
def search_list(data, target):
return [[i for i, d in enumerate(data) if d == t] for t in target]
class TestIt(unittest.TestCase):
def testIt(self):
self.assertEqual([[0, 2], [10], [5, 6, 7]],
search_list([1,4,1,4, 6, 5, 5, 5, 4, 2, 3], [1, 3, 5]))
if __name__ == '__main__':
unittest.main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment