I solved on CODBEE but the console did not understand my code. It may have to do with their old 1.8.7 ruby engine. I get this error:
(eval): 1: `upcase 'for unchanged method 65: (eval) from Fiction (Noble Enterer): 1: in (eval)' map ': 1: In' LetterCapitalize '(eval): 6
I reel on the latest version of the replay on my computer and tested on my computer on v2.0.0 and in both places Work is fine / P>
This is my starting code:
DEF laser captioning (SRR) str.split.map {| I | I have [0] .upcase + i [1..i.length]} included ("") end
In the beginning I have a question that my answer is either upright or efficient. In an attempt to understand the error, to understand the "upcasing method", why was the engine of 1.8.7 Ruby not considered on Koderbyte?
The difference is as follows:
If passed to a single FXN In that case, the character code comes back. In
it returns a single letter string, which is expected of you in your code.
You need to get a string instead. One of the ways to convert FixName to a string would be:
str.split.map {| I | I [0] .chr.upcase + i [1..i.length]}. ("")
Since string
response Chr
should work in a later version of Ruby.
Another solution would be to use two logic versions of []
, which returns a string:
str.split.map { | I | | I [0,1] .upcase + i [1..i.length]} contains ("")
No comments:
Post a Comment