Also, I have no idea what you second if statement is about.
Your whole approach seems to be prone to errors, I'd actually recommend coming back to this one after solving more katas first. Also, when you post code, use proper code formatting, and read this troubleshooting FAQ first.
"You will be given two strings a and b consisting of lower case letters, but a will have at most one asterix character. The asterix (if any) can be replaced with an arbitrary sequence (possibly empty) of lowercase letters. No other character of string a can be replaced. If it is possible to replace the asterix in a to obtain string b, then string b matches the pattern."
For me ut is simple as that.
Can you give me any example when my sollution is wrong ?
Your code mutates the input. The kata description says you shouldn't.
This comment is hidden because it contains spoiler information about the solution
Also, I have no idea what you second
if
statement is about.Your whole approach seems to be prone to errors, I'd actually recommend coming back to this one after solving more katas first. Also, when you post code, use proper code formatting, and read this troubleshooting FAQ first.
This comment is hidden because it contains spoiler information about the solution
Literally the first example...
Your code would return False. Your code just removes the asterisk, but it can be replaced with any other string to match the strings, if possible.
"You will be given two strings a and b consisting of lower case letters, but a will have at most one asterix character. The asterix (if any) can be replaced with an arbitrary sequence (possibly empty) of lowercase letters. No other character of string a can be replaced. If it is possible to replace the asterix in a to obtain string b, then string b matches the pattern."
For me ut is simple as that.
Can you give me any example when my sollution is wrong ?
Your solution isn't complete. For example, try adding this test case:
Test.assert_equals(solve("code*code","codewars"), False)
Your solution would return True, when it's clearly wrong.
Your solution is incorrect, the task isn't so simple. Read the description again, especially the first example. Also, add spoiler flag next time plz.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Because 2 is a prime
why isnt 12 in the array ? is not a prime..
0 will return true this is a issue here ;)
yes it is
https://primes.utm.edu/lists/small/10000.txt
My bad sorry;
Is 19 a prime?
Loading more items...