public
Last active — forked from srid/gist:185695

  • Download Gist
gistfile1.py
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
def original():
for i in range(10):
for j in range(10):
for k in range(10):
if i == j and j == k:
yield "All equal"
elif (i == j and j != k) or (i == k and j != k):
yield "2 equal"
else:
yield "None equal"
 
def original2():
return ["All equal" if i==j and j==k else (
"2 equal" if (i==j and j!=k) or (i==k and j!=k) \
else "None equal")
for i in range(10)
for j in range(10)
for k in range(10)]
 
 
assert tuple(original()) == tuple(original2())

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.