Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Introduction to Python List Comprehensions
#9
(04-06-2010, 04:17 PM)Fallen Wrote: One liner FTW!
Code:
print sum([x for x in xrange(1000) if x % 3 == 0 or x % 5 == 0])
;3
Must you shorten everything I write?
[Image: izsyo6.jpg]


Reply


Messages In This Thread
RE: Introduction to Python List Comprehensions - by uber1337 - 04-06-2010, 05:38 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Python Help Dεlluzion 3 1,794 09-30-2019, 12:59 AM
Last Post: samsmith001
  Simple Python Python Compiler Canoris 21 8,487 06-01-2011, 06:30 PM
Last Post: Filefinder
  Python 2 vs 3? Jake 8 2,276 12-11-2010, 04:13 PM
Last Post: Bursihido
  Python help Kharnage 2 770 02-12-2010, 09:07 PM
Last Post: Kharnage
  "==" and "is" in Python Canoris 1 757 02-07-2010, 03:55 PM
Last Post: uber1337

Forum Jump:


Users browsing this thread: 1 Guest(s)