Input data for exercises - Challenges code

What happens

The input data for each exercise is in Data.lst but I don’t understand how it works.

What do you understand or find about that problem

I receive a group of data, if so what type of data is it? for example in codeabbey-021 is it an array of numbers? in codeabbey-028 is it a two-dimensional array? or all the data I review from Data.lst regardless of the exercise is a string that I must manipulate?

You make any workaround? What did you do?

I understand that the solution is given in functions, using a functional language would be more friendly to the rectum, so opt for pure Javascript. I have done the following:

  • Put those values in a constant
  • I understand that if I put an input parameter in the function it will be the data from Data.lst and that it arrives as a string, so I manipulate the string.

Something I have thought and noticed in some of the exercises I have detailed is that I must import that file, however I think I would not know how to do it with Javascript, if so I could use import instruction only works for modular programming as far as I know

:slightly_smiling_face: :slightly_smiling_face: !!

If you want to import files in JS you can use ‘fs’ on node (but here is not supported and we don’t need that you import the file), but you don’t need to import the file, only read the data as an input or param, make cat DATA.lst read all the data as a string, you must pass that as an input or parameter to your functions.

you should be able to make something similar to an input() on python or to a gets() on C or the way that a lot of languages have to read from the stdin, try to read about stdin and how you can use stdin on JS

If you look at the inputs of most exercises in Codeabbey it is taken by stdin (standard input), DATA.lst is only the input of the exercise and you can send it to your solutions through pipes like:

cat DATA.lst | ./mysolution

Now if you use Javascript you may need to run it by terminal and there are many tutorials on the internet that help you with that

Thank so much !!

Yes, I read again the submission and in the programming solutions I indicated this part, I will try to use the process.stdin.on(“data”, ()=> {}) to read the input data.