6 kyu
Tom's Allergies
150 of 305Lusina
Loading description...
Algorithms
Puzzles
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.
Ruby 3.0 should be enabled, see this to learn how to do it
How does 1000 equal ["cats", "chocolate", "pollen", "strawberries"]. I understand bitwise calculation. But then after that also I dont understand how it will equal to that result. Can anyone help me understand?
This comment has been hidden.
My class' method fail in 'ignore_non_allergen_score_parts' section of the test. Printing the score show 257. Take a look at:
ignore_non_allergen_score_parts
Log
257
['eggs'] should equal ['cats', 'chocolate', 'eggs', 'peanuts', 'pollen', 'shellfish', 'strawberries', 'tomatoes']
This is my class being used with that value in the interative python:
I am quite confused by the issue here, can you explain exactly what the problem is? Because it seems you have a wrong implementation and your function fails the test, it does not look like an issue with the test cases.
Otherwise, I am marking this as resolved, as it seems your implementation fails this test.
The problem is that the test fail with class when it passes it 257 as score, and it says my class return the list ['eggs']. When I use my class, and I pass it 257 return ['cats', 'chocolate', 'eggs', 'peanuts', 'pollen', 'shellfish', 'strawberries', 'tomatoes']
I am a JSer and not good at bitwise calculate. This kata helps me a lot!
When the score is 257,why allergies are eggs instead of cats and eggs? I was confused about how the score make up? Why the score can be 1000?
Did you see hint?
Thanks!I finally understand it!
PHP version!Cheers
Seen and approved! Thank you!
@BrianLusina you have made cool kata,thanks!
IMO add puzzle tag ;D
I concur, it should be used more often for this kind of neat katas :)
Hmm,:?, I actually had overlooked the puzzle tag. I have updated and added it.
The second example should be:
Allergies(255).allergies()
this way the description don't give any hints about the implementation.
Already fixed some time ago, between this and this fork
In python the instruction example says says: allergies = Allergies(0) allergies.is_allergic_to('peanuts') = True
In the test it says: allergies = Allergies(0) allergies.is_allergic_to('peanuts') = False
Noted and updated. Thank you
Crystal translation kumited too; you might notice the tests for the type missing, but they are kinda pointless in a statically typed language.
The rest is all there :)
Noted. Crystal translation approved. :+1:
My code works fine except for the tests where it's supposed to throw a type error. I've tested the code in my IDE (PyScripter) with all the invalid data types I can think of and it always throws a type error there, but apparently it's not doing it in the kata tests. Is there something I'm missing? Is each invalid data type supposed to show a specific error message?
Nope, just the same error message and the same type of exception is thrown for each data type that is not an integer.
This comment has been hidden.
This comment has been hidden.