If you print out messages about what you're doing in the code, you could then read those messages to get an idea of what happened. You'd probably want to start with what the input and output was, consider whether that's indeed wrong and then start looking what happened between those.
I'm just starting to learn how to code. The test for this challenge show me this at the end.
Test Passed: Value == 3
Expected: 0, instead got: 4
Test Passed: Value == 2
Expected: 4, instead got: 9
I don't understand what went wrong with my code. I want to ask for a hint, maybe I need to do an if statement to fix the first error and another loop inside of the loop I already have to fix the second error. I just trying to fix this but I don't understand exactly how.
Thanks in advance for your help.
Occam's razor suggests your outside environments to not have the same tests as on Codewars.
Your code doesn't do that. Also, returning inside the loop like that, the code inside it runs only once, because
return
exits the function.This comment is hidden because it contains spoiler information about the solution
If you print out messages about what you're doing in the code, you could then read those messages to get an idea of what happened. You'd probably want to start with what the input and output was, consider whether that's indeed wrong and then start looking what happened between those.
Maybe, but without seeing your code, nobody can tell for sure. Read this: https://docs.codewars.com/training/troubleshooting
I'm just starting to learn how to code. The test for this challenge show me this at the end.
Test Passed: Value == 3
Expected: 0, instead got: 4
Test Passed: Value == 2
Expected: 4, instead got: 9
I don't understand what went wrong with my code. I want to ask for a hint, maybe I need to do an if statement to fix the first error and another loop inside of the loop I already have to fix the second error. I just trying to fix this but I don't understand exactly how.
Thanks in advance for your help.