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.
I think it is better to train yourself to be a oneliner. Actually I am new here. It is my second day here. And I am trying my best to complete challenges with one line only. It is fun you know. And it changes your mind a lot. THANK YOU ONE LINERS. You teach me a lot.
two years ago but we can assume the input will always be a bool since that is what it takes as an argument. Since its taking a boolean as an argument it is reasonable to assume it isn't accepting user input, rather the boolean is being generated elsewhere in the code.
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!
Yes, but kata solutions don't necessarily have to be efficient (unless the kata tests explicitly require them to be such).
This is really cool,but I'll learn it later when I become an expert!
Also, for generally creatively short and impractical code, look up code golf! You'll probably find some challenges and guides.
The best way might just be to do katas on here and look at the solutions sorted by "clever" at the end, and then trying to understand them.
can you tell where you can learn this type of code i want to learn that type can anybody tell where i can learn
ヽ(≧□≦)ノ
ヽ(≧□≦)ノ
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.
i have no idiea ,absolute code
I think it is better to train yourself to be a oneliner. Actually I am new here. It is my second day here. And I am trying my best to complete challenges with one line only. It is fun you know. And it changes your mind a lot. THANK YOU ONE LINERS. You teach me a lot.
XD
You are pretty good))))
Well I call it Best Practices.
two years ago but we can assume the input will always be a bool since that is what it takes as an argument. Since its taking a boolean as an argument it is reasonable to assume it isn't accepting user input, rather the boolean is being generated elsewhere in the code.
This is really quite novel. Nice!
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!
Loading more items...