Exercise 2: Padding and Justifying
Justify a string by padding it.
We'll cover the following
Problem statement
There’s a method that allows us to justify a string by
Look for that method by skimming through the Ruby documentation for strings. Use it on the input string to accomplish the same task as before.
Example
input_string = "ruby"
result = "ruby<3<3<3"
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy