So for a HW assignment, we're making a Yahtzee game. At least part of it. For preparation, our professors gave us a few questions to understand the main point of the assignment.
1) The following documentation is provided for one function:
def roll_dice(): ''' rolls 5 dice, and returns a list of frequencies of each possible value for example, element [3] of the return value is how many 3's appeared '''
GIven this documentation, and the fact that the dice are six-sided cubes with the numbers 1,2,3,4,5,6 to choose from, which of these would be a correct return value from this function?
Ans: [0, 1, 0, 2, 0, 2, 0]
2) Given the same documentation as the previous question, which of these would represent a dice roll with 4 2's?
Ans: [0, 0, 4, 0, 0, 1]
3) Which of the following would represent a case where all five dice rolled the same value, considering the documentation in the first question?
Ans: [0, 0, 0, 5, 0, 0, 0]
4) In the game of Yahtzee, a full house is defined to a situation where three of the dice have the same number, and the other two dice equal each other (but different from the first three).
Which of these would represent a full house, given the documentation from the first question?
Ans: [0, 2, 0, 0, 3, 0, 0]
I don't understand how to interpret these types of questions. For 1) the range would be from (0,2)? Hence giving you the random amount of times for getting it? Or would we be using choices() with weights instead? For the second one, what does the '4' represent? The third question is along the same lines.
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)