7 kyu

Rithm Series: Frame a Phrase Simple

222 of 370tigarcia

Description:

Carpe Diem! Yolo! On Fleek? Crushing it. You've got some awesome phrases that you want to hang up on your wall. The problem is that you don't have any frames laying around. So instead, you decide to write a program to create your frame.

Write a function called frame that will take two parameters as input: a phrase and optionally a character for the border of the frame.

frame("Yolo", '@');

Returns:

@@@@@@@@
@      @
@ Yolo @
@      @
@@@@@@@@

Notice that the framed phrase has a single space to the left and to the right. Also, there is an empty line both above and below the phrase.

If a second parameter is not given, assume the frame should be decorated using the * character.

You can assume that all phrases are a single line (no new line characters), and that the second parameter to the function (the frame character) is always a single character.

If an empty string is passed in, return an emtpy frame. For example:

frame("");

returns:

****
*  *
*  *
****
Fundamentals
ASCII Art

More By Author:

Check out these other kata created by tigarcia

Stats:

CreatedDec 31, 2016
PublishedJan 3, 2017
Warriors Trained581
Total Skips1
Total Code Submissions2148
Total Times Completed370
JavaScript Completions222
Python Completions166
Total Stars13
% of votes with a positive feedback rating85% of 120
Total "Very Satisfied" Votes92
Total "Somewhat Satisfied" Votes21
Total "Not Satisfied" Votes7
Total Rank Assessments10
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • tigarcia Avatar
  • JohanWiltink Avatar
  • albertogcmr Avatar
Ad