Question: for python Dice Rolling Simulator with Functions Goal: This project involves writing a program that simulates the rolling of dice using FUNCTIONS. Using your experience
for python Dice Rolling Simulator with Functions
Goal: This project involves writing a program that simulates the rolling of dice using FUNCTIONS. Using your experience from Part 1 and 2, and your newly learned knowledge of FUNCTIONS, complete the following Tasks
TIP: We are creating functions out of the code we wrote in Part 2. """
import random
""" Task 1: In Part 1 and Part 2, you created a list of die faces named mydice_list. You are doing the same here, except now you will create a function that will create the list of die faces and return that list. """ def dice_list(): """Create and return a list of die faces"""
### YOUR CODE HERE ###
""" Task 2: In Part 1 and Part 2, you selected a random die face from mydice_list using random.randint(). You are doing the same here, except now you will create a function that will call dice_list() to create a list of die faces, and then select a random die face from that list and return it. """ 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 ###
""" Task 3: Create a function that creates a list of "rolled" dice. The function should take in 0 or 1 arguments. If no arguments are passed the function should default to 1.
TIP: What kind of loop can we use when we know exactly how many times it needs to run? """ def roll_lots_of_dice(how_many=1): """ Return a list of "rolled dice". """
### YOUR CODE HERE ###
""" Task 5: All code below here should only run if we are in "__main__" """
### YOUR CODE HERE ###
""" Task 6: Similar to Part 2, continue to ask the user for input (how many dice to roll) until they input 0. Only when the user inputs 0 should the program end.
You'll need to call a function to "roll" the dice
Output the LIST of all the "rolled" die faces """ ### YOUR CODE HERE ###
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
