Draft
Will you get head?
16Yushi.py
Loading description...
Mathematics
Probability
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.
Why the test
prediction(0, 3, 1, 6)
should beTrue
. obviously there is no chance to win any prize!You cannot claim that the probability of a coin landing heads is
heads / total
. If I threw a coin3
times and it didn't land heads in any of those, then it's reasonable to say that the coin is unlikely to roll heads, but not impossible.While I cannot tell you the actual value, you'll see that, while the probability is low, it's not zero, and it's good enough for the values of the bet.
This comment has been hidden.
What is the "Excpected value of the bet" and how do you calculate it.
This is a shitkata I've given up on, and I don't think it should be approved at all anymore. Anyway, I'll still answer your question.
It's a mathematical concept, so I'm just repeating something you'd find on the internet.
Let's say we have an event that can yield multiple outcomes with different values associated with each. The expected value is the sum of the probability of an outcome's value multiplied with it's probability for all outcomes of the event.
I'll not go too much into it; there are way more sources online that can explain it better than I can.
For this problem, the even has only two outcomes: heads or tails. If you get heads, you win the prize; if you get tails, you gain nothing.
So the expected value is just the probability of getting heads times the prize value. It gets a bit unintuitive with negative values for the prize, but the idea remains.
Thanks for explaining!
You don't explain what "the expected value" is. Is it part of the kata for the user to figure this out? Specially, in case of a "possibly biased coin", whatever that means.
This comment has been hidden.
I don't plan on getting this approved anymore, but I added it, they only go up to
1000
, no reason in going that big for a theory focused kata.I didn't add the values for
bet
orprize
because in theory they can go up to like1_000_000
but it never does and it doesn't really matter.I'm just solving the issue so I don't have it marked as a due issue on my profile.