Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1
In each line, print not exactly <scale> chars, but at most <scale> chars, breaking at last word separator (whitespaces) or end of string. You'll have to rethink the loop exit condition and how you slice the string.
29th Apr 2022, 12:40 PM
Emerson Prado
Emerson Prado - avatar
+ 1
First, think on how to find the indexes for the first and last printable word in each line, then print this slice. Hint: search whitespaces. Note how each line impacts the next. Then, loop until the string finishes printing, not a fixed number of times.
29th Apr 2022, 2:04 PM
Emerson Prado
Emerson Prado - avatar
+ 1
Ash[Back In The Rhythm] Sorry I don't know Ruby. But while looking at your code I have discovered that you can remove the white space between the words that start on a new line. Such as number in and voodoo prime text = %{A Voodoo prime is a prime number whose reciprocal (in decimal) has the same numberin its digits. For example, 7 is a voodooprime because its reciprocal 1/7 = 0.14285714285 contains 7.}
29th Apr 2022, 8:44 PM
Chris Coder
Chris Coder - avatar