Skip to main content

Timeline for Display numbers lacking 2's

Current License: CC BY-SA 4.0

15 events
when toggle format what by license comment
Oct 9, 2018 at 12:49 comment added Gigaflop @JonathanFrech Thanks for the tip!
Oct 9, 2018 at 12:49 history edited Gigaflop CC BY-SA 4.0
added 260 characters in body
Oct 9, 2018 at 3:01 comment added Jonathan Frech '2'in str(n)or print(n) is shorter than a comprehension guard.
Oct 5, 2018 at 13:11 history edited Gigaflop CC BY-SA 4.0
added 4 characters in body
Oct 4, 2018 at 19:34 comment added JosiahRyanW @Gigaflop Ah, I get it. Still, I do find it cool that they're able to do that.
Oct 4, 2018 at 19:33 comment added Gigaflop @JosiahRyanW I misread your comment and saved just the list comprehension [print(n)for n in range(1,101)if"2"not in str(n)] as a one-line file, and it output the desired results when I ran it. That's what I thought was implicit printing.
Oct 4, 2018 at 19:30 history edited Gigaflop CC BY-SA 4.0
added 40 characters in body
Oct 4, 2018 at 19:30 comment added JosiahRyanW It's not really "implicit printing", but rather a print statement inside a list comprehension. You still need the print statement.
Oct 4, 2018 at 19:29 comment added Gigaflop @JosiahRyanW I wasn't aware of the implicit print, thanks!
Oct 4, 2018 at 19:24 comment added JosiahRyanW Alternatively, based on one of the Python 2 answers: n=17;exec("print((n>177)*10+n//9);n+=10;"*81)
Oct 4, 2018 at 19:22 comment added JosiahRyanW [print(n)for n in range(1,101)if"2"not in str(n)] works.
Oct 3, 2018 at 18:07 history edited Gigaflop CC BY-SA 4.0
added 2 characters in body
Oct 3, 2018 at 18:07 comment added ElPedro Welcome to PPCG! You can get it down to a round 50 by deleting the space before the if.
Oct 3, 2018 at 18:05 review First posts
Oct 3, 2018 at 18:16
Oct 3, 2018 at 18:03 history answered Gigaflop CC BY-SA 4.0