Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python Goal: we need to be able to roll, count each die and add up their total value. import random def dice_list(): Create and return

python

Goal: we need to be able to roll, count each die and add up their total value.

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 12c SQL

Authors: Joan Casteel

3rd edition

1305251032, 978-1305251038

More Books

Students also viewed these Databases questions