r/shittyprogramming • u/permalink_save • Sep 22 '21
How to draw an hourglass using Python
print('\n'.join([f*' '+'@'*(10-f)+'@'*(10-f)+' '*f for a in [list(range(0,10))] for f in a + a[-2::-1]]))
94
Upvotes
66
u/kevin_wylder Sep 23 '21
“@“ * (10-f) + “@“ * (10-f)simplifies to
”@“ * (20-2*f)but also complicates to
int(2 ** math.pi * 2 // 1).to_bytes(1, ‘big’).decode() * round(cmath.log(485165195.4) / (cmath.cos(2*f) + 1j*cmath.sin(f*2)).real)30
u/Porkenstein Sep 22 '21
I was going to downvote this til I saw the subreddit. Quality content here
37
u/howreudoin Sep 22 '21
Output:
https://i.imgur.com/vhVTWhN.jpg
8
u/martindines Sep 22 '21
Nice
13
u/user_5554 Sep 23 '21
Wait, you have the outer loop comprehension before the inner? How the hell is a even defined where f is defined?
And what the fuck is that join call?? This doesn't deserve to live.
4
u/xd1936 Sep 23 '21
⏳
4
u/Dushenka Sep 23 '21
Now animate it.
0
u/syserrmsg Sep 23 '21
-bash: syntax error near unexpected token `('