You need to sign in or sign up before continuing.×
Retired

Dice Possibilities (retired)

Description:

Task:

Given two integer numbers, [s] is for [sides] of a dice, [c] is how many times getting the same number [continuously]

The number of possibilities for that is (1/[s])^[c]

You are going to return the number of possibilties, and to be more clear, let's see some examples:

  1. dice_possibilities(6,2) => this means that there are 6 sides on a dice, and 2 times getting the same number continuously, so the number of possibilities for this is (1/6) * (1/6) or (1/6)^2. return 1/36

  2. dice_possibilities(3,3) => this means that there are 8 sides on a dice, and 4 times getting the same number continuously, so the number of possibilities for this is (1/3) * (1/3) * (1/3) or (1/3)^3. return 1/27

  3. dice_possibilities(0,3) => return False

  4. dice_possibilities(2,0) => return False

Note:

  • If any of the [s] or [c] is 0, return False, since it's impossible to have 0 side on a dice or 0 times getting the same number continuously

  • [s] >= 0

  • [c] >= 0

Have Fun! ;)

Fundamentals
Mathematics
Algorithms
Logic
Numbers

Stats:

CreatedJun 1, 2021
Warriors Trained18
Total Skips0
Total Code Submissions33
Total Times Completed14
Python Completions14
Total Stars2
% of votes with a positive feedback rating13% of 12
Total "Very Satisfied" Votes1
Total "Somewhat Satisfied" Votes1
Total "Not Satisfied" Votes10
Total Rank Assessments10
Average Assessed Rank
7 kyu
Highest Assessed Rank
7 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • John Tso Avatar
Ad