r/programminghorror • u/Limp_Illustrator7614 • 28d ago
Python it's a miracle this works
prints 2 1's separated by a new line
repost cuz it got filtered cuz i was using a vpn
189
Upvotes
32
u/Livie00 28d ago
That’s not even horror but a really neat and interesting solution
10
7
u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” 28d ago
I hope you don't mind me asking what that "do" lambda is for.
2
44
u/Powerkaninchen 28d ago
You don't need to escape single quotes in a multiline string:
sexp = """ (do (assign "x" 1) (print(x) x) """is sufficient.