Spooky Sale: 10% off Premium yearly · $118.80 for the first year · until Nov 6Get it

Deep-ML
Learn
Problems1,200+ hands-on ML problemsLearning PathA guided route through the fundamentalsLabsInteractive labs on real techniquesProjectsBuild a GPT, an RL agent, CUDA kernelsCollectionsCurated problem sets and videosMathPen-and-paper math for MLIntuitionInvent the idea behind the formula yourselfPlaylistsYour own problem lists, shareableStudy AssistantAn AI teacher that knows your progress
Interview Prep
Compete
ContestsFresh problem sets, ranked liveLeaderboardWhere you stand, globallyBuddiesSolve with a friend: streaks, a weekly board, chat
Discuss
Deep-Path
Premium
      Intuition
      47 of 102

      Is it luck?

      Someone flips a coin flips times and gets heads heads. Write surprise(heads, flips): if the coin were fair, how surprising is this result? 1 means not surprising at all; near 0 means very surprising. math.comb(n, k), the number of ways to choose k of n, is available.

      Someone flipped a coin 20 times and got 15 heads. Flip a fair coin yourself: each run of 20 lands in the pile for its number of heads. Then let a fair coin do 1,000 runs.

      the example: 15 heads in 20 flipsyour flips, with a fair coinhow many heads each run of 20 got · dots: your 0 runs0102015flip the coin yourself, or let a fair coin run 1,000 times
      Your functionsurprise(heads, flips)
      headshow many of the flips came up headse.g. 10
      flipshow many times the coin was flippede.g. 20
      returns1 if a fair coin would do this easily, near 0 if it's very surprising
      solution.pyLoading Python
      Sign in for an AI hint
      ← Never say neverTwenty jelly beans →