Reference no: EM132170363
Python For Loops - Version 3
User will roll 5 dice with the goal of getting 5 of a kind within 4 rolls. The resulting number on each die will be generated randomly. User can use the "random" module to cbetween 1 and 6. You can read about the random module in the Python documentation.The way you will use it is something like random.randint(a, b).
The user will decide which of the values they want to keep out of the current roll. For instance if the current roll is (2, 3, 2, 1, 6), the user may specify that they wish to keep the 2's. In this case, in the dice that do not contain the value 2 will be rolled again. If the player does not have 5 of a kind after 4 rolls, inform them that they have lost the game and ask if they would like to play again. If they have 5 of a kind, inform them that they have won the game. Remember, the user may change their mind as to which values to keep so it shouldn't be assumed that they are trying for the same value for all 4 rolls. At each roll, your program should show the current value of each die. For instance, the program might look like this:
Hi, welcome to Yat!
Your first roll is: 5, 6, 1, 5, 5
Which value you would like to keep?
5
Your second roll is: 5, 5, 6, 5, 5
Which value would you like to keep?
5
Your third roll is: 5, 5, 5, 5, 5
You WIN!
Would you like to play again? Please enter Y (yes) or N (no) etc...