Here is an easy-intermediate challenge for anyone interested!
What is that?
A thing me and brother do a bit too often is this:
One of us has a problem and asks the other to explain how to do certain stuff. The other just says the following carelessly:
How to <verb> in <n> easy steps!
(Newline mandatory)
Step 1 - Do not <verb>.
Step 2 - Do not <verb>.
Step 3 - Do not <verb>.
.
.
.
Step <n> - <verb>. (Capitalised)
For example, if my brother could not find a pen to write with (Do not ask me why) and asked How do I find a pen?
, I would probably answer:
How to find a pen in 10 easy steps!
Step 1 - Do not find a pen.
Step 2 - Do not find a pen.
Step 3 - Do not find a pen.
Step 4 - Do not find a pen.
Step 5 - Do not find a pen.
Step 6 - Do not find a pen.
Step 7 - Do not find a pen.
Step 8 - Do not find a pen.
Step 9 - Do not find a pen.
Step 10 - Find a pen.
Sarcasm alert!
Now isn't that so accurate and helpful!
<verb>
is the problem one of us wants to achieve.
<n>
is a random number that we choose (for your information, we mostly use 10 as <n>
, but that is not important for this challenge).
So what?
Your challenge is to write a usual program or function using standard I/O and golfing rules that takes in a string formatted with "How do I <v>?"
as input, and then print or return the (accurate) how-to article specified according to the rules displayed above, where <verb>
is <v>
from the input, and <n>
is any random natural number from the range 1 to 10 (inclusive) generated by your program. When <n>
is 1, remove the ending s in ...steps!
.
Standard loopholes are not allowed!
Note: There might be some cases where sentences will be illogical, like in the case of How do I find my pen?
. Outputting How to find my pen in <n> easy steps
is fine!
Here is another example for further clarity:
Input -
How do I make coffee?
Example output -
How to make coffee in 3 easy steps!
Step 1 - Do not make coffee.
Step 2 - Do not make coffee.
Step 3 - Make coffee.