Question: Python related question :) I need some help writing a function yahtzee that takes a number (n) dices as a parameter, and which allows the
Python related question :)
I need some help writing a function yahtzee that takes a number (n) dices as a parameter, and which allows the user to roll the dice until she get yahtzee, i.e all n dices show the same value. In each round the function must select a value 1-6 to be saved, so that a maximum number dice showing the same value is set aside. The function should also return the number of rounds that at last one dice had to be rolled befor the yahtzee was obtained. In each round, the function must print out what the dices show.
example:
in: yahtzee(5)
out: [1, 2, 2, 4, 6]
[ 2, 2, 2, 5, 4]
[2, 2, 2, 2, 2]
out: 3
in addition to above, how can one get out i.e: "Yahtzee with 5 dices in 3 throws!" ?
thanks!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
