I have two strings in variables x and y, where the length of x is greater than the length of y. How can you map the smaller string (y) to the size of the large string (x)?
For example:
x = "appleappleapple" # (length 15)
y = "abc" # (length 3) This should be mapped to "abcabcabcabcabc"
while len(y) < len(x):
y+=y
while len(y) > len(x):
y = y[:-1]
print x
print y
appleappleapple
abcabcabcabcabc
Is there a very pythonic/efficient way to do this operation?