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.
Python random tests are no longer susceptible to input mutation.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
I've reproduced those tests in the
sample tests
section and my code pass them.Also after a closer look at the random tests it would seem that all the tests with a
Money
value other than0
expects a result of0
so the issue might be somewhere else in therandom tests
implementation.I ran the "oracle" in your two examples, and the expected output is
1
for both, not0
. You might be misreading the failure message.Hi, the oracle for the Python random tests seems broken.
In the random tests I've seen the following results:
1194
136
[8, 390]
[136]
390 * 3 + 8 * 3
136
That's because there are not sufficient tests, duplicate issue.
The expression
ROMAN[k]
has an implicitany
type since TypeScript currently always treats the variable in a for...in as astring
. This is problematic and means you do not have type protection when accessingROMAN
with random string values. The TypeScript issue https://github.com/Microsoft/TypeScript/issues/3500#issuecomment-579360564 is attempting to address this.This has not been correct since 2015: https://2ality.com/2015/10/property-traversal-order-es6.html
The insertion order for the specific object they created can be relied upon.
The object ROMAN is not guaranteed to be iterated through in the order it was declared according to JS specification, you should instead rely on an array, or just convert using
Object.keys(ROMAN).map(k => [k, ROMAN[k]]).sort((a, b) => b[1] - a[1])
.This comment is hidden because it contains spoiler information about the solution