Write a function spaced(s) that outputs spaces and a dashdot border around a string s.
The sample code, which calls spaced(“Hello”) would output:
--.-.-.-.-
. .
- Hello -
. .
-.-.-.-.-.
Please help me out with this :D. Im new to programming and im trying to learn this stuff. I dont have any programming experience so its quite a challenge to me. Thanks everyone!
the key to programming is looking for patterns, and then implementing them.
define your requirements:
• must have fixed-space fonts
• border at the top/bottom needs to be the length of text + margin (white space) + border
• text must have two spaces in all directions (vertical and horizontal)
• you want alternating periods and hyphens
Remember, you can only predict spacing for fixed width fonts. If you have any questions about the function above, ask in the comments. Cheers.