Dec-01-2017, 08:30 PM
Hello! I am taking a combinatorics and probability course and the final project requires us to use python. I am a complete newb and have no idea where to even start. I understand all of the concepts however I do not have any background in python. Any advice, help, hints would be greatly appreciated. You don't need to directly answer the question as I too would like to be challenged, however some guidance would be awesome.
Here is the first question.
Implement a function that takes two dices as input and computes two values: the first value is the number of times the first dice wins (out of all possible 36 choices), the second value is the number of times the second dice wins. We say that a dice wins if the number on it is greater than the number on the other dice.
To debug your implementation, use the following test cases:
Sample 1
Input: dice1 = [1, 2, 3, 4, 5, 6], dice2 = [1, 2, 3, 4, 5, 6]
Output: (15, 15)
def count_wins(dice1, dice2):
assert len(dice1) == 6 and len(dice2) == 6
dice1_wins, dice2_wins = 0, 0
# write your code here
return (dice1_wins, dice2_wins)
Here is the first question.
Implement a function that takes two dices as input and computes two values: the first value is the number of times the first dice wins (out of all possible 36 choices), the second value is the number of times the second dice wins. We say that a dice wins if the number on it is greater than the number on the other dice.
To debug your implementation, use the following test cases:
Sample 1
Input: dice1 = [1, 2, 3, 4, 5, 6], dice2 = [1, 2, 3, 4, 5, 6]
Output: (15, 15)
def count_wins(dice1, dice2):
assert len(dice1) == 6 and len(dice2) == 6
dice1_wins, dice2_wins = 0, 0
# write your code here
return (dice1_wins, dice2_wins)