Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Because for char in s, we are iterating over each character in the string s, and for each character c, we are multiplying it by 2 (c * 2) to create a new string with the character repeated twice. The join() method is then used to concatenate all the doubled characters into a single string.
It's not dissimilar to a 'for' loop with a list. Think of it as 'for [any item] in [what I'm telling you to look at]'.
In this case we're telling the program to look at a string, so the 'any item' is just 'any/each individual letter'. 'C' is simply a placeholder for that.
I appreciate this is checks watch 11 months late, but I hope it helps if you ever return here!
I'm confused as to why it knows c represents characters in the strings
Hi, new to coding. Why is else being used for no reason in this example?