Guest User

Untitled

a guest
Jan 18th, 2015
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.29 KB | None | 0 0
  1. def strings(count):
  2.  
  3.     for _ in range(count):
  4.  
  5.         yield "aba"
  6.  
  7. def match_ends(words):
  8.  
  9.     return len( [word for word in words if len(word)>=2 and word[0] == word[-1] ] )
  10.  
  11. match_ends2 = lambda ws: sum(len(w) >= 2 and w[0] == w[-1] for w in ws)
  12.  
  13. print(match_ends(strings(10 ** 9)))
Advertisement
Add Comment
Please, Sign In to add comment