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 Revisions

3 of 4
added 2387 characters in body
Kevin Cruijssen
  • 136.2k
  • 14
  • 154
  • 394

05AB1E, 74 bytes

TLΩÐD≠'s×ばつsI8.$ ̈©"€ß€„ÿ€† ÿ‡šŠ\ÿ!
"ˆG®N"Š\ ÿ - Do€–ÿ."ˆ}®TMs"Š\ ÿ -ÿ."ˆ ̄.a»

Try it online.

Explanation:

TL # Push a list in the range [1,10]
 Ω # Pop and push a random value from this list
 ÐD # Triplicate + Duplicate, so 4 copies are on the stack
 ≠ # Check if the top copy is NOT equal to 1 (0 if 1; 1 if [2,10])
 's×ばつ '# Repeat "s" that many times
 s # Swap so one random integer copy is at the top again
 I # Push the input
 8.$ # Remove the first 8 characters ("How do I")
 ̈ # Remove the last character ("?")
 © # Store this verb in variable `®` (without popping)
"€ß€„ÿ€† ÿ‡šŠ\ÿ!\n" # Push dictionary string "how to ÿ in ÿ easy stepÿ!\n",
 # where the `ÿ` are filled with the top three values on the stack
 # from left to right
 ˆ # Pop and add this string to the global_array
G # Pop another random copy, and loop `N` in the range [1, n):
 ® # Push the verb from variable `®`
 N # Push `N`
 "Š\ ÿ - Do€–ÿ." # Push dictionary string "step ÿ - Do not ÿ.",
 # where the `ÿ` are filled with the top two values again
 ˆ # Pop and add this string to the global_array
} # After the loop:
 ® # Push the verb again
 .a # Sentence capitalize it
 s # Swap so another random integer copy is at the top of the stack
 "Š\ ÿ -ÿ." # Push dictionary string "step ÿ - ÿ.",
 # where the `ÿ` are once again filled automatically
 ˆ # Pop and push this string to the global_array as well
 ̄ # Then push the global_array
 .a # Sentence capitalize each string (without changing existing caps)
 » # And join this list by newlines
 # (after which the result is output implicitly)

See this 05AB1E tip of mine (section How to use the dictionary?) to understand why "€ß€„ÿ€† ÿ‡šŠ\ÿ!\n" is "how to ÿ in ÿ easy stepÿ!\n"; "Š\ ÿ - Do€–ÿ." is "step ÿ - Do not ÿ."; and "Š\ ÿ -ÿ." is "step ÿ - ÿ.".

Kevin Cruijssen
  • 136.2k
  • 14
  • 154
  • 394

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