7 kyu
Percentage of amino acids
191 of 459JasperGeh
Loading description...
Fundamentals
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Are the tests consistent between JS and Python?
aa_percentage('CPRVPYYKKHDLQDTRHTIFHVFV'), should the result not be 38? Instead it expects 0.
do you get that in
JSor in python? (edit: python, since snake_case... I'll take a look)I've passed all the tests in JS, but using the same logic in Python, I get different results. If the amino list isn't passed in , it's default to ['A','I','L','M','F','W','Y','V']. Is my logic wrong in thinking that I should simply count the number of chars that are in the amino list vs the string and taking that as a percentage?
several things:
arelook different. In JS, you can end up with empty strings, splitting on target chars (I assume the "view solution" is showing me your actual solution...?) (EDIT: the ref sol in JS seems to use the same approch, tho... I guess I misunderstood soemthing about that...)This comment has been hidden.
Aha! x)
Classic pythonic mistake of yours, here. ;) look a the following message... ;o
This comment has been hidden.
Ah goddammit, I should have known better. Thank you.
Every protein consists of a long chain of 20 different amino
yet some of the tests have more than that.not an issue, you misunderstood the sentence: this actually tells that there are 20 amino acids with which you can build the proteins. That's not the nombre of AA per protein (often, one protein consists of thousands of AA).
;)
Ah yes, you're right. Still pretty confusing since all the basic tests are 20 characters long.
occurances -> occurrences
.
needs random tests in python
Enhanced JS random tests. Added them to python.
(at least in python) Maybe there should be at least one example test that uses rounding, to avoid surprises between testing and submitting solution?
It seems that your reference solution is rounding down in the JavaScript random tests. Please either (1) edit the description to reflect this or (2) edit your reference solution if rounding down is not intended.
This comment has been hidden.
Codewars Forums - Kata Best Practices - Follow Conventions
Identifier names in JavaScript (i.e. variable/function names) should be in
camelCase
and notsnake_case
(source: W3Schools) - please change the name of the user function fromaa_percentage
toaaPercentage
.Done
Needs random tests
Yep, adding asap :)
Should work now :)
Thanks for adding them in JavaScript but make sure you add them for Python as well ;)