Front 3 - Slice Check Repeat Concatenate

Published by Werdna in

Create a function that takes a string; we'll say that the front is the first three characters of the string. If the string length is less than three characters, the front is whatever is there. Return a new string, which is three copies of the front.

Examples

front_three("Python") ➞ "PytPytPyt"

front_three("Cucumber") ➞ "CucCucCuc"

front_three("bioshock") ➞ "biobiobio"

Notes

Don't forget to return the result.

Watch a quick demo on how Edabit works.