11
\$\begingroup\$

This question already has an answer here:

My answer here works only on the interactive Python prompt, which writes output to the screen if not stored in a variable or None. Is such an answer valid?

\$\endgroup\$

marked as duplicate by user62131, Wheat Wizard, Mego, mbomb007, programmer5000 Apr 18 '17 at 17:45

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    \$\begingroup\$ Given the poor wording of the question “output must read”, is not clear. Personally I would prefer to avoid such answers – if everybody comes with one like that, the challenge will not be challenging anymore. By the way, that solution is also valid in browsers' JavaScript consoles and if you change to double quotes, in interactive Ruby too. \$\endgroup\$ – manatwork Jan 23 '14 at 15:01
  • 2
    \$\begingroup\$ With double quotes, it would also be valid in non-interactive GolfScript (which inherits Ruby's double quoted string syntax wholesale, and has auto-printing of program return values built in). I'll leave it to others to decide if that's an argument for or against it. \$\endgroup\$ – Ilmari Karonen Jan 23 '14 at 19:36
16
\$\begingroup\$

In my opinion, such answers should be valid unless the OP states otherwise.

These answers often reflect a different slant to the problem, and we all like variety, don't we? I don't think we should remove this dimension of creativity by default, but if the OP doesn't want such answers, they can of course say so.

From the perspective of a code golfer, I like to avoid the overhead of output that come with some languages. Some languages (such as GolfScript) produce output automatically, so I think it's fair to use a REPL interpreter to do the same thing.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged .