← Back to challenges

Cycling Through Strings

PythonHardloopsstrings

Instructions

Given two strings, repeatedly cycle through all of the letters in the first string until it is the same length as the second string.

Examples

string_cycling("abc", "hello") ➞ "abcab"

string_cycling("programming", "sample") ➞ "progra"

string_cycling("ha", "good morning") ➞ "hahahahahaha"

Notes

All tests will include valid strings.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Outlier Number