I'm trying to create code for the following problem:
In this simple Kata your task is to create a function that turns a string into a Mexican Wave. You will be passed a string and you must return that string in an array where an uppercase letter is a person standing up.
Following is my tenative solution to the problem:
def wave(people):
newstring = [*people]
final=[]
for i in range(len(newstring)):
newstring[i].title()
final.append("".join(newstring))
return final
The example 'should' return:
wave("hello") => ["Hello", "hEllo", "heLlo", "helLo", "hellO"]
whereas mine returns;
['hello', 'hello', 'hello', 'hello', 'hello']
I'm new to coding, but the way it works in my head is that I split up the string, iterate through my loop capitalizing the character corresponding to the loop number, then I append the newly joined string to my empty list. This loop continues supposedly to go through the same string, capitalizing the next character, and adding to the "final" list. This (in my head at least) should produce the example return above. Unfortunately, I get my output as above. What gives?
Thanks