Question: for python Counting the Dice Goal: Now that we can roll some dice, we need to be able to count each die and add
for python
""" Counting the Dice
Goal: Now that we can roll some dice, we need to be able to count each die and add up their total value.
Reuse some of the functions you wrote in Part 3, and we'll create two more functions that will find the value of each rolled die and sum them all up. """
import random
def dice_list(): """Create and return a list of die faces"""
### YOUR CODE HERE ###
def dice_roll(): """ Return a randomly selected die face from the list of dice faces that is returned from calling dice_list() """ ### YOUR CODE HERE ###
def roll_lots_of_dice(how_many=1): """Return a list of "rolled dice"."""
### YOUR CODE HERE ###
""" Task 1: Create a function that takes in a die face, and returns its INTEGER value. """ def get_dice_value(die_face): """ Returns the INTEGER value of a die face.
Example: -If ".." is passed as argument, then 2 should be returned -If "....." is passed as argument, then 5 should be returned """
### YOUR CODE HERE ###
""" Task 2: Create a function that takes in a LIST of the rolled die faces and returns the sum.
Example: -If ['.', '...'] is passed in, should return 4 -If ['...', '..', '.'] is passed in, should return 6 """ def add_up_rolled_dice_faces(list_of_rolled_faces): """ Returns the sum of a list of rolled die faces."""
### YOUR CODE HERE ###
if __name__ == "__main__":
""" Task 3: Keep asking the user for input (how many dice to roll) until they input 0.
Output the LIST of all the "rolled" die faces each time, and the sum of those dice """
### YOUR CODE HERE ###
Step by Step Solution
There are 3 Steps involved in it
This is a complete question where a student is asked to write a Python program to simulate rolling dice then sum up the possible values Lets break dow... View full answer
Get step-by-step solutions from verified subject matter experts
