Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This program is for Python 3.5 Create a program that will roll dice for a dice game. For this you will have to use sys.

This program is for Python 3.5

image text in transcribed

Create a program that will roll dice for a dice game. For this you will have to use sys. argv to accept a bunch of dice strings formatted as xdy. In this string Y is an integer that tells us how many sides the die has and x tells us how many times to roll the die (i.e. 5D6 means to roll a 6 sided die 5 times). The program should print out the result of each roll as well as the total of each dice string. Your program should be able to accept an arbitrary number of dice strings from the command line. Make sure your program has a function to check each xdy argument for correctness. An example output for rolling a 20-sided die one time and then a 6-sided die 3 times are given below: >>> LUCENT_DEL_dice.py 1D20 5D6 D20 #1: 17 Total D20: 17 D6 #1: 3 D6 #2: 2 D6 #3: 3 D6 #4: 6 D6 #5: 1 Total D6i 12 You will have to have a main () function for both of these programs as well as separate functions in the second program that ensure the dice string is correctly formatted AND another to a

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

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions