Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • \$\begingroup\$ "Input must be printed at first"... while 1:print k;k=randint(0,~-k) should work (with an error at the end) \$\endgroup\$ Commented Jul 9, 2018 at 16:28
  • \$\begingroup\$ ...and then while 1:print k;k=randrange(k) saves two. \$\endgroup\$ Commented Jul 9, 2018 at 16:30
  • 1
    \$\begingroup\$ @JonathanAllan Thanks :), The questions says I can use an empty line instead of 0, so no error. \$\endgroup\$ Commented Jul 10, 2018 at 6:56