Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
You're still printing all tests together.
This is the input of the first test your code fails:
It looks like your code isn't detecting the plateau peak.
getting same error , inputs dont match outs : cannt debug
should_pass_all_fixed_and_edge_assertions
1,2,3,6,4,1,2,3,2,1,3,2,3,6,4,1,2,3,2,1,2,2,2,1,2,1,3,1,2,2,2,2,1,2,1,3,1,2,2,2,2,2,1,3,2,2,2,2,5,6,2,1,3,2,2,2,2,1,1,2,5,4,3,2,3,6,4,1,2,3,3,4,5,3,2,1,2,3,5,5,4,3,
Expected: equal to {pos = {2, 7, 14, 20}, peaks = {5, 6, 5, 5}}
Actual: {pos = {2, 7, 14}, peaks = {5, 6, 5}}
should_pass_100_randomly_generated_assertions
3,10,9,7,20,12,19,11,-5,4,6,-1,-1,19,-1,15,0,15,8,8,-2,14,16,0,15,-2,11,17,4,19,2,-5,7,14,20,1,15,13,3,-2,0,8,5,8,9,1,15,4,15,3,9,8,0,17,4,6,7,2,5,9,15,20,5,17,0,1,9,8,6,14,-3,16,0,13,7,7,15,1,17,6,16,-3,2,1,8,8,4,-2,-4,-2,-1,8,-4,4,14,12,20,-1,6,-2,-4,13,16,6,-1,5,2,7,1,13,4,5,20,10,18,15,-3,1,-5,1,-1,16,8,11,10,0,10,16,13,15,18,5,13,5,12,-1,12,-2,7,7,10,18,8,-1,17,3,4,-2,5,12,12,9,7,1,1,-2,8,16,20,2,13,17,15,
Expected: equal to {pos = {1, 3, 7, 10, 12, 14, 16, 21, 24, 26, 29, 38, 41}, peaks = {16, 11, 16, 18, 13, 12, 12, 18, 17, 4, 12, 20, 17}}
Actual: {pos = {1, 3, 7, 10, 12, 14, 16, 21, 24, 26, 38, 41}, peaks = {16, 11, 16, 18, 13, 12, 12, 18, 17, 4, 20, 17}}
You're printing the input of several tests together.
Print a carriage return to separate them.
You're printing the input of several tests together.
Print a carriage return to separate them.
should_pass_all_fixed_and_edge_assertions
Log
1,2,3,6,4,1,2,3,2,1,3,2,3,6,4,1,2,3,2,1,2,2,2,1,2,1,3,1,2,2,2,2,1,2,1,3,1,2,2,2,2,2,1,3,2,2,2,2,5,6,2,1,3,2,2,2,2,1,1,2,5,4,3,2,3,6,4,1,2,3,3,4,5,3,2,1,2,3,5,5,4,3,
Expected: equal to {pos = {2, 7, 14, 20}, peaks = {5, 6, 5, 5}}
Actual: {pos = {2, 7, 14}, peaks = {5, 6, 5}}
the test input dont match the output correctly wtf is this
should_pass_all_fixed_and_edge_assertions
Log
1,2,3,6,4,1,2,3,2,1,3,2,3,6,4,1,2,3,2,1,2,2,2,1,2,1,3,1,2,2,2,2,1,2,1,3,1,2,2,2,2,2,1,3,2,2,2,2,5,6,2,1,3,2,2,2,2,1,1,2,5,4,3,2,3,6,4,1,2,3,3,4,5,3,2,1,2,3,5,5,4,3,
Expected: equal to {pos = {2, 7, 14, 20}, peaks = {5, 6, 5, 5}}
Actual: {pos = {2, 7, 14}, peaks = {5, 6, 5}}
the input vect does not match the expected result , because there is no peaks at those positions
this makes no scence
for that reason it's called Random Tests.
I made an attempt and one test failed. I didn't change anything and tried again - and all tests passed. This is weird, it shouldn't be like this.
At least you have an idea of how to solve it.
thx, you overcome my brain damage. i was thinking it for 2 hour
Please read this:
Your code fails with tests like this one:
It returns
{'pos': [1, 3, 5], 'peaks': [3, 19, 17]}
instead. 3 at position 1 is not a plateau peak, 19 at position 3 is higher.Not a kata issue, use
Question
label next time.This comment is hidden because it contains spoiler information about the solution
Thank you for the helpful advice. This will be very useful for me in the following exercises.
Or you can print the input yourself: https://docs.codewars.com/training/troubleshooting#print-input
My code passed "TEST" but failed "ATTEMPT". Some of the tests in "ATTEMPT" returned an error:
{'pos': [2, 5, 8], 'peaks': [20, 12, 20]} should equal {'pos': [2, 5, 8, 11], 'peaks': [20, 12, 20, 12]}
The problem is that in "ATTEMPT", the error messages do not contain the input data. Which makes it very difficult to understand what exactly is not working correctly in my code. Please improve the error message in "ATTEMPT". So that the student can see exactly which input data was passed to the code.
Loading more items...