7 kyu
Price is right
423Austin Haws
Loading description...
Algorithms
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.
Good kata, but let's not make misogynistic references such as female canines, as I saw on the JavaScript kata!
The title is a play on the game show The Price is Right. Happy Gilmore has Bob Barker in it. A quote from Happy Gilmore from Bob has swearing. I didn't want to abuse any code warrior's sensitive untainted eyes, so I used the direct definition of the swear. HA!
approved as test suite looks sufficient, no pending issues, choice of title was explained by author and there aren't any negative votes
I know maybe I'm being picky, but I fail to see where is the price in this kata (both in the title and function's name). The tests use negative numbers too, so prices seem wrong to me.
Isn't that a reference to some TV programme where you had to guess prices of things?
Negative numbers are a very natural continuation of natural numbers ( non-negative, i.e. prices ), so I see no real problem there.
Maybe, it just felt a little disconnected about what to do here (to me at least).
Chrono79, you are the next contestant on the Price is Right! Come on down! And don't forget to spay or neuter your pet. lol.
It's a game show where you have to guess the price without going over. I didn't want the hassle of dealing with decimals, so let's just pretend that the integers are the prices in ¥en.
Lol. It's clear now thanks both.
Returning inconsistent datatypes is not a best practice.
I'd suggest throwing an
Error
, returningNaN
( which actually is aNumber
),undefined
( which, polymorphically, might be aNumber
), or possibly-Infinity
.It now uses undefined instead of false if a number isn't found. Thanks!