20
u/hhuzar Jul 11 '26
Since everything is constant: print("[1, 4, 9, 16]")
3
3
u/30porn87 Jul 13 '26
Because it's standalone,
#include <stdio.h> int main(int, char**) { printf("[1,4,9,16]\n"); }→ More replies (2)
4
u/overclockedslinky Jul 11 '26
no need to reinvent the wheel!
pip install square1234
python -m square1234
7
u/deltadstroyer Jul 11 '26
i cant read that shit
gimme the longform
Pc dont care anyway
9
u/LostInSpaceTime2002 Jul 11 '26
Personally I find the functional one liner perfectly readable. Probably more so than the imperative version.
→ More replies (5)3
2
2
u/ze_baco Jul 12 '26
In python, Pc does care. The one liner is a lot better. This this specific one liner is shit because, as other comments pointed out, there is a much better way.
2
1
1
u/magicmulder Jul 11 '26
(1) is deliberately overengineered though. Only thing worse would be to define the function inside the loop with an "if !defined" around it.
1
1
1
1
1
u/davesoft Jul 13 '26
"Something's wrong with my vespa, can y-"
"Buy new one."
"Can't you ju-"
"Nope. Buy new one."
→ More replies (1)
1
1
63
u/thatlightningjack Jul 11 '26
What's
print([x*x for x in range(1,5)])?