Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

deleted 27 characters in body
Source Link
totallyhuman
  • 17.4k
  • 3
  • 34
  • 89

Jelly, 13 bytes

2X"¢;ÆS»ẋ"ʋ¢»

Try it online!

Explanation:

2X"¢;ÆS»ẋ"ʋ¢»
2X push a randomRandom number (1 or 2 to the stack)
 "¢;ÆS» pushCompressed "duck\n"string toequivalent theto stack"duck\n"repeatRepeat the "duck\n" that random number of times (pops the number)
 "ʋ¢» pushCompresses "goose"string toequivalent theto stack"goose"
 entire stack is printed implicitlyImplicitly atconcatenated programand terminationreturned

More readable version: Try it online!

Will always return 1 or 2 ducks.

Jelly, 13 bytes

2X"¢;ÆS»ẋ"ʋ¢»

Try it online!

Explanation:

2X"¢;ÆS»ẋ"ʋ¢»
2X push a random number 1 or 2 to the stack
 "¢;ÆS» push "duck\n" to the stackrepeat the "duck\n" that random number of times (pops the number)
 "ʋ¢» push "goose" to the stack
 entire stack is printed implicitly at program termination

More readable version: Try it online!

Will always return 1 or 2 ducks.

Jelly, 13 bytes

2X"¢;ÆS»ẋ"ʋ¢»

Try it online!

Explanation:

2X"¢;ÆS»ẋ"ʋ¢»
2X Random number (1 or 2)
 "¢;ÆS» Compressed string equivalent to "duck\n"Repeat the "duck\n" that random number of times
 "ʋ¢» Compresses string equivalent to "goose"
 Implicitly concatenated and returned

More readable version: Try it online!

Will always return 1 or 2 ducks.

Jelly, 13 bytes

2X"¢;ÆS»ẋ"ʋ¢»

Try it online!

Explanation:

2X"¢;ÆS»ẋ"ʋ¢»
2X push a random number 1 or 2 to the stack
 "¢;ÆS» push "duck\n" to the stack
 ẋ repeat the "duck\n" that random number of times (pops the number)
 "ʋ¢» push "goose" to the stack
 entire stack is printed implicitly at program termination

More readable version: Try it online!

Will always return 1 or 2 ducks.

Jelly, 13 bytes

2X"¢;ÆS»ẋ"ʋ¢»

Try it online!


More readable version: Try it online!

Will always return 1 or 2 ducks.

Jelly, 13 bytes

2X"¢;ÆS»ẋ"ʋ¢»

Try it online!

Explanation:

2X"¢;ÆS»ẋ"ʋ¢»
2X push a random number 1 or 2 to the stack
 "¢;ÆS» push "duck\n" to the stack
 ẋ repeat the "duck\n" that random number of times (pops the number)
 "ʋ¢» push "goose" to the stack
 entire stack is printed implicitly at program termination

More readable version: Try it online!

Will always return 1 or 2 ducks.

added 141 characters in body
Source Link
user202729
  • 17.6k
  • 2
  • 39
  • 71

Jelly, 13 bytes

2X"¢;ÆS»ẋ"ʋ¢»

Try it online!


More readable version: Try it online!

Will always return 1 or 2 ducks.

Jelly, 13 bytes

2X"¢;ÆS»ẋ"ʋ¢»

Try it online!


Will always return 1 or 2 ducks.

Jelly, 13 bytes

2X"¢;ÆS»ẋ"ʋ¢»

Try it online!


More readable version: Try it online!

Will always return 1 or 2 ducks.

Source Link
user202729
  • 17.6k
  • 2
  • 39
  • 71
Loading

AltStyle によって変換されたページ (->オリジナル) /