Spent a lot of time struggling to figure out how my code could be wrong before realizing that the solution did not want a zero-based index. Now that I realize it, the example does make it clear (in 466 example, the solution is "1"), but I did not read carefully enough and wasted at least a half hour as a result. Good luck!
the indexes you should return are "1, 2, or 3," not "0, 1, or 2" as you might expect
You must be signed in to leave a comment
Okanlawon Oluwatobi Damilare
23 March 2019, 17:00
Basically, the computer starts counting from 0 but since codegym is yet to make mention of that, so it is safe to think the computer starts counting from 1.
15 February 2019, 16:09
A lot of tasks are poorly worded on Codegym. You need to pay really close attention, and you will still fail verification plenty of times. In code, every index is 0 based. It makes no sense for Codegym to change that in this task, other than maybe they haven't taught arrays yet. Still very poorly thought out. Just wait for the tasks that the requirements (the points that are tested) don't match the task conditions. One task in particular says this in the conditions: The method should calculate the body mass index and display the following message: "Normal: 18.5 <= BMI <= 24.9" - if the body mass index is between 18.5 and 24.9, "Overweight: 25 <= BMI <= 29.9" - if the body mass index is between 25 and 29.9, Then the requirements say: 1) The calculateBMI method should display "Normal: 18.5 <= BMI < 24.9" if the body mass index is between 18.5 and 24.9. 2) The calculateBMI method should display "Overweight: 25 <= BMI < 29.9" if the body mass index is between 25 and 29.9. Notice how the two outputs differ from the conditions and requirements. Anyways, ask for help if you are stuck on any task. There are plenty of people who answer questions in the help section. I recommend to just keep moving along though, it may take a little time to receive an answer. Codegym users are all over the world.
15 February 2019, 20:21
That may be correct, I haven't encountered that question. However, in this particular task, the requirements were clear. I just made assumptions without reading carefully enough.