7 kyu
Find an employees role in the company
1,467 of 2,948incidental
Loading description...
Fundamentals
Arrays
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.
Python translation
Approved
gravity falls is best show ever
on Python i get the name Mort and on the dict, the name is Morty, so it does not match, is this intentional? or is it a error?
There is no test with the name
"Mort"
in Python, and if there were, they would be different persons. If you're talking about sample tests, you could have edited them by mistake, click reset.Meanwhile, the initial solution setup gives us
r
as the second argument, which could be interpreted as ratio for geometric sequences.I think you posted in the wrong kata, closing.
Ruby 3.0 should be enabled.
Enabled in this fork
This comment has been hidden.
Added in Ruby.
Three test cases are always passed. You can even put pass in function. It's in Python 3.4
This comment has been hidden.
Full names are unique, but there actually is another Anna in
employees
. So you can't tell which Anna you're looking for; then treating such input as invalid becomes a viable strategy.I think the description should be changed to indicate that the single names are invalid names (return value == 'Does not work here!').
Its not related to OOP, tag should be removed.
Done
This comment has been hidden.
OP solved it, closing
Perhaps in the description of the employees variable, the keys should be strings.
Fixed :)
This comment has been hidden.
This comment has been hidden.
try to add a print out u will see the problem
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
Try to input a "wrong" name.
This comment has been hidden.
A bit difficult to guess what your code is doing: possibly some problem in the way you set up your loop?
.
JS users have to check for an array of objects with name employees Is not on the instructions but was written on the other languages.
[{firstName: "John", lastName: "Doe", role:"Carpenter"}...]
Is it just me or are the challenges needlessly complicated? Am I supposed to create the objet literal or is it already written ? please help i have 2 points.....
It is there, is being passed, I was just pointing out how is the structure build and the name of it so you can have access to it in your method. Sadly was poorly translated to JS, not being the case in the original language, I feel your frustration but understand that this is a free service of people like you and me helping each other creating this kata, please let me know if you still have trouble solving this in JS and I can help you out.
This comment has been hidden.
This comment has been hidden.
OP solved it, closing
JavaScript Description does not show the code which is actually intended there after "It uses the following structure."
Is it just me or are the challenges needlessly complicated? Am I supposed to create the objet literal or is it already written ? please help i have 2 points.....
seems to be resolved, now.
This comment has been hidden.
OP solved it, closing
It uses the following structure:
...blank. What is the structure? JavaScript.
Is it just me or are the challenges needlessly complicated? Am I supposed to create the objet literal or is it already written ? please help i have 2 points.....
Hello, JS Kata Description does not explicit "employees" variable structure. Regards Yves
Is it just me or are the challenges needlessly complicated? Am I supposed to create the objet literal or is it already written ? please help i have 2 points.....
In the description for the python version the dict keys read as variables and not strings, i.e no qoutes around first_name etc.
The same is true for the Ruby description.
Fixed, thanks!
.
The Ruby version of this kata does not specify that employees is a global variable
$employees
.It seems this is tripping people up, myself included.
I agree with the issue reported by TheBmachine. I had the same problem
In the description, you say
However, one of the test cases tests for the name 'Anna'. You should either change that test case, or put in the description what to do with an invalid name as input.
For reference, this is in python, but not JS (I don't know about in Ruby).
Now python version has in description: "the name passed in will be a single string with a space between the first and last name i.e. Jane Doe or just a name." And it sounds like "just a name" is also a valid input. For more clarity you should add something like that at the end "though only former should be considered as valid input". Otherwise it's unclear why Anna Bell works in the company but Anna doesn't.
.
The javascript also returns an error similar to the ruby version "ReferenceError: employee is not defined". Also the description doesnt have any info on the arrays structure. Is it a double array? One long string?
Just completed JS; did not encounter such an error. Could you post your code with
spoiler
?Nevermind, my bad. User error. I was using "employee" instead of "employees" and also didn't understand that an object literal in JS is somewhat equivalent to a hash in ruby. I was using it as an array of arrays instead of an array of hashes. I learned something new about JS so we'll call it a success.
As mentioned by samzhao2008, I'm getting a
undefined local variable or method 'employees' for main:Object
error in the Ruby version.I'm getting this as well on Ruby
Actually, it is a global variable with String keys:
Someone can update Ruby kata description?
.
Can not reference variable employees in ruby version. Is it a special task leave for me to find it?
This comment has been hidden.
Fixed, thanks :)
.
Nice kata, translated into both Python and Ruby if you want to approve them :)
Hi There
Thanks for translating this kata, I could only see a translation for Ruby however? I have approved that one, if you could give me a shout with details on the Python translation I will be happy to approve that one also.
Many thanks
My pleasure translating, but can you tell me if it works with a direct link like this?
Perhaps storing the array in another (randomly created) variable would be better so people won't change its contents.
Hi Acraileanu
Yeah i spotted that some users had just changed the structure of the objects. Will look into changing that for sure.
Thanks for the heads up
Moved the array of employee objects into the preloaded section so it will not show up in the solution at all but can still be referenced using the employees variable. I also updated the description to note this and give an example of the object structure.