Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for I Love Python! by han97
# migrated from python 2.7
def i_love_python():
"""
Let's explain why do we love Python.
"""
assert hasattr(abs, "__doc__") # functions are objects, introspection
[abs(x) for x in range(-10, 10)] # list comprehension
def gen(): # simple generators
for c in "Python":
yield c
gen2 = (c for c in "Python") # generator comprehension
return "I love Python!"
Aug. 4, 2016