Question: Part 2 - Rolling Dice to a Total Given an n - sided die, we want to determine how many different ways one could repeatedly
Part Rolling Dice to a Total
Given an nsided die, we want to determine how many different ways one could repeatedly sum die rolls and get to a given total.
For instance, given a sided die, we could obtain a total of in four different ways:
rolling a three times
rolling a and then rolling a
rolling a and then rolling a
rolling a
We will write two different functions to solve this problem. Each functions takes the number of sides on the die and total the total to which we'll sum rolls as input. Each function must use its corresponding dynamic programming methodology in order to solve the problem.
waystosummemon total
must use memoization
vaystosumtabn total
must use tabulation
waystosummemo total
waystosumtab total
Imports
No imports allowed on this assignment, with the following exceptions:
Any modules you have written yourself
typing this is not required, but some students have requested it
For testing only do not use these for functionality in any other classesalgorithms:
unittest
random
Submission Requirements
Students must submit individually by the due date.
At a minimum, you must submit the following files:
linkedist.py
vaystosum.py
Additionally, you must include any other files necessary for your code to run, such as modules containing data structures you wrote yourself.
Note that we are not requiring tests here. We have instead provided tests for you. We'll begin requiring tests again for the next homework, but we are prioritizing giving you multiple chances to practice recursion this week, since it's an area where we typically need a lot of practice. See here for some more practice problems.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
