
Take Control – Choose how to license your stuff and who can edit it, track every change
Join Siafoo Now
or
Learn More
Efficient Python implementation
1
Updated over 6 years ago (08 Nov 2012 at 08:35 AM)
recent activity
In Brief | Real code trolling :D, note the generator expression combined with built in function any(), it will return after the first miss match. |
Language | Python |
# 's
1import random
2a = [random.randrange(1,10) for x in range(1,10)]
3b,a = a,sorted(a)
4while any((s1!=s2 for s1,s2 in zip(a,b))):
5 random.shuffle(b)
Real code trolling :D, note the generator expression combined with built in function any(), it will return after the first miss match.
Add a Comment