[SOLVED] Why this doesn't generate a string as expected? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

[SOLVED] Why this doesn't generate a string as expected?

I'm trying to generate a encryption key as mentioned in thr CryptoCube challenge, but the output isn't as expected instead it generates a very long integer. Can someone help me figure what I'm doing wrong? I'm trying to generate something like this, 0:U:U:L:R,1:U,2:D:R,3:U:R https://code.sololearn.com/czbsZdG1Y9Zc/?ref=app https://www.sololearn.com/learn/9884/?ref=app

13th Jul 2018, 2:51 PM
Rusty.Metal
3 Answers
+ 6
Line 25 is adding your 2 characters ':' and the map one together. Change ':' to ":" and you will get string concatenation.
13th Jul 2018, 3:08 PM
John Wells
John Wells - avatar
+ 6
Always use double quotes on characters to make them a string of one character, if you are using them in strings.
13th Jul 2018, 3:16 PM
John Wells
John Wells - avatar
+ 2
Thank you Mr. John Wells, I didn't know that would've been the problem.
13th Jul 2018, 3:10 PM
Rusty.Metal