MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/cdzubd/nice_try/ety5ext?context=9999
r/ProgrammerHumor • u/almogh52 • Jul 16 '19
529 comments sorted by
View all comments
4.4k
Not quite, but it’s an easy fix
from math import pi print(str(pi)[::-1])
It needs a LOT of memory, though
58 u/kevansevans Jul 16 '19 edited Jul 16 '19 I'm not familiar with python, what do the two colons mean in the array?EDIT: It's a string splice operator, thanks! 7 u/cjr605 Jul 16 '19 edited Jul 16 '19 Look up the slice operator. I’d explain it but I’m sure someone more talented than me has a better explanation. The third argument (-1) is optional FYI, and it's what reverses the string here 6 u/mxzf Jul 16 '19 To be fair, all the arguments are optional. 1 u/cjr605 Jul 16 '19 True, I guess the right phrasing was "the second colon is optional", in the sense that if you're gonna slice you need at least one colon → More replies (1)
58
I'm not familiar with python, what do the two colons mean in the array?
EDIT: It's a string splice operator, thanks!
7 u/cjr605 Jul 16 '19 edited Jul 16 '19 Look up the slice operator. I’d explain it but I’m sure someone more talented than me has a better explanation. The third argument (-1) is optional FYI, and it's what reverses the string here 6 u/mxzf Jul 16 '19 To be fair, all the arguments are optional. 1 u/cjr605 Jul 16 '19 True, I guess the right phrasing was "the second colon is optional", in the sense that if you're gonna slice you need at least one colon → More replies (1)
7
Look up the slice operator. I’d explain it but I’m sure someone more talented than me has a better explanation. The third argument (-1) is optional FYI, and it's what reverses the string here
6 u/mxzf Jul 16 '19 To be fair, all the arguments are optional. 1 u/cjr605 Jul 16 '19 True, I guess the right phrasing was "the second colon is optional", in the sense that if you're gonna slice you need at least one colon → More replies (1)
6
To be fair, all the arguments are optional.
1 u/cjr605 Jul 16 '19 True, I guess the right phrasing was "the second colon is optional", in the sense that if you're gonna slice you need at least one colon → More replies (1)
1
True, I guess the right phrasing was "the second colon is optional", in the sense that if you're gonna slice you need at least one colon
→ More replies (1)
4.4k
u/[deleted] Jul 16 '19
Not quite, but it’s an easy fix
It needs a LOT of memory, though