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.
If you mean the last two sample tests in python, they are correct.
If the year is 2001, this code still provides the correct answer.
An issue is a bug or problem with the kata. This is not an issue.
This isn't an issue with the tests, it's an issue with your code. You're mutating the input.
You've created an infinite loop. It only triggers when your code reaches the second sample test, so when your code returns the correct answer for the first test, your code will time out.
The description says that you have to return the largest of all the generated numbers after doing all the rotations. As 85821534 is the largest number, that is the one that you return.
You can read the docs listed on the left hand side of the site to see how codewars works. Other than that, you just need to get the basics of your programming language down, especially how functions work. You can learn as you go, just be prepared to do research whenever you encounter something that you don't understand or know how to do.
You need to write a function, which you've done, but the function you've written doesn't take any arguments, and you've also changed the name of the function. The way the website works is for each task, there is a battery of tests that will call your function with various inputs and then compare the value that your function returns to the correct answer to see if they're the same. Right now, your function will only double the values in one specific list because you've hardcoded the list into your function instead of accepting a list as an argument to your function. Also, printing anything from your code will not do anything other than display whatever you've printed in the log, printing doesn't interface with the tests in any meaningful way.
Your code does not pass the kata, it's not correct at all
You have to use
Math.pow()
, notmath.pow()
Yes it is. You're raising the digits to the power of 3, you're supposed to raise the digits to the amount of digits in the input number. So,
7
would be7**1
which is7
because the number7
only has one digit.The problem is not with the section of code that you quoted, the problem is with your
areOpposite
function. You are summing the first letter of each direction to see if they are opposites, but this doesn't really work because two possible direction combinations sum to the same number. Manually check'N' + 'N'
and'W' + 'E'
, and you should see what I mean. In this case, anytime yourareOpposite
function is called forNORTH
andNORTH
, it will returntrue
, which is not what you want.There is no issue with the tests.
Not a suggestion
Updated the sample tests for python here. This fixes the issue mentioned here
Loading more items...