Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in 3rd party category for I Love Python! by SiLiKhon
# migrated from python 2.7
import numpy as np
def i_love_python():
"""
I love Python for the powerful one-line expressions (which I kinda abuse...)
"""
for yi in np.linspace(1.5,-1.,20): print(''.join([' ' if abs(xi**2 + (1.25*yi-np.sqrt(abs(xi)))**2 - 1) > 0.16 else 'W' for xi in np.linspace(-1, 1, 40)]))
return "I love Python!"
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
assert i_love_python() == "I love Python!"
Jan. 27, 2017
Comments: