What can One-Line-Python-Code do?

Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense.

We can use Python Online Console to run the demo.

python_dot_org_console

Heart

print('\n'.join([''.join([('ILOVEYOU'[(x-y) % len('ILOVEYOU')] if ((x*0.05)**2+(y*0.1)**2-1)**3-(x*0.05)**2*(y*0.1)**3 <= 0 else' ') for x in range(-30, 30)]) for y in range(30, -30, -1)]))

heart

Eight Queens

[__import__('sys').stdout.write('\n'.join('.' * i + 'Q' + '.' * (8-i-1) for i in vec) + "\n========\n") for vec in __import__('itertools').permutations(range(8)) if 8 == len(set(vec[i]+i for i in range(8))) == len(set(vec[i]-i for i in range(8)))]

eight_queens

Fibonacci

print([x[0] for x in [(a[i][0], a.append([a[i][1], a[i][0]+a[i][1]])) for a in ([[1, 1]], ) for i in range(30)]])

fibonacci