| about | help | code help+videos | done | prefs |
streakOdds() - Recall that a fair coin has a 50% chance of coming up heads. The probability of flipping two heads in a row is (0.5)^2 = 0.25 = 25%; three heads in a row is (0.5)^3 = 0.125 = 12.5%, and so on. In general, if the odds of some event occurring are P percent, then odds of it occurring N times in a row are 100*((P/100)^N). Given the percentage P for an event and positive integer N, calculate and return odds of the event occurring N times in a row. streakOdds(50, 1) → 50.0 streakOdds(50, 2) → 25.0 streakOdds(50, 3) → 12.5 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Copyright Nick Parlante 2017 - privacy