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*

4
  • \$\begingroup\$ You can save a few bytes by using stdin instead of command line args. \$\endgroup\$ Commented Aug 6, 2017 at 23:04
  • \$\begingroup\$ 29 bytes, you don't need to cast the input to an int because the input function in Python 2 does eval on the input before returning. You also don't need parentheses around the input call. \$\endgroup\$ Commented Sep 29, 2017 at 22:02
  • \$\begingroup\$ Oh, actually... This code doesn't even work. Theoretically, it would work if infinite 1's were given as input, but that doesn't meet the spec. Since while is calling the input function every time, it will just print one 1 and then reach the end of the input and error. Your earlier solution with command line args did work, or you can assign the input to a variable before looping. \$\endgroup\$ Commented Sep 29, 2017 at 22:13
  • \$\begingroup\$ @LyricLy yeah, I tried that once. Thanks! \$\endgroup\$ Commented Sep 30, 2017 at 19:14