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.
Ah! I see it. It's what I missed. Thanks fam
It is in the MDN docs here. This table shows all of the 'magic strings' you can pass to
String.prototype.replace
.That's not regex and it's not inline with the docs at MDN. Where am i wrong?
Hi ozichukwu,
$1
refers to the first group (captured by the()
).why does
"$1"
work? what does it mean?MDN said the second argument of
replace
can either be string or function. Thanks in advance.This comment is hidden because it contains spoiler information about the solution
Check that you are only summing elements at prime numbered indices: 2,3,5,7,..
Remember marking your post as having spoiler content.
This comment is hidden because it contains spoiler information about the solution
Must be an off-by-one error. Can you post your code here? Note also that indices start at 0, not 1 (except for Fortran)
I'm doing this in python. All my basic tests pass but the random ones all fail. My code produces a value is consistantly slightly over the expect. I can't figure out why. Any tips?
Thanks,
-Matt
This comment is hidden because it contains spoiler information about the solution
This was so much fun. This got me thinking about and visualizing regexes in a whole new way!
So I had to google "are there negative prime numbers" and got conflicting answers but it seemed like in theory you just consider the absolulte value of a number as to wether it was prime or not. So I wrote my solution that way and it will return is_prime(-7) as True.
I guess if they are testing random inputs they aren't testing random negative ones.