The task consists to complete the function which takes a string, and returns an array with rotation of the given string, in uppercase. This function moves each first character of the string to the end, and stops once the string returns to its original state as below:
'cat'
'atc'
'tca'
The problem is that my code returns ['atc', 'atc', 'atc']. Where's the problem?
def scrolling_text(text):
returned_text = text.upper()
list_of_switchs = []
text_length = len(text)
while len(list_of_switchs) <= text_length:
switch = returned_text[-1:] + returned_text[:-1]
list_of_switchs.append(switch)
if len(list(list_of_switchs)) == text_length:
break
return list_of_switchs