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
      37 of 130

      Which sum comes up most?

      Roll two fair dice, one with sides_a faces and one with sides_b, each numbered from 1. Write chance_of_total(total, sides_a, sides_b): the chance that one roll of the two adds up to total. The puzzle asks about two ordinary six-sided dice, a four-sided die with a six-sided one, and two eight-sided dice.

      A dark die and a light die, rolled 360 times; every total goes into its column. Eleven totals are possible, so is each one an 11th of the time? The columns say no. The goal is the exact chance of each total, for any two dice.

      Roll a dark die and a light die, both six-sided, and add them up.dark + light0 of 360 rollshow often each total came up23456789101112
      Your functionchance_of_total(total, sides_a, sides_b)
      totalthe sum the two dice should add up toe.g. 1
      sides_ahow many faces each die has (6 for an ordinary die), numbered from 1e.g. 6
      sides_bhow many faces each die has (6 for an ordinary die), numbered from 1e.g. 6
      returnsthe chance that one roll of the two dice adds up to total
      solution.pyLoading Python
      Sign in for an AI hint
      ← Cut the long tailSame birthday in the room →