Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python: Write a dice game program that generates thrown pairs of dice and depending on the outcomes, adds or subtracts money from your total money

Python: Write a dice game program that generates thrown pairs of dice and depending on the outcomes, adds or subtracts money from your total money count (total miney starts at 0). This program has a function that generates and returns two lists (if the same length) of random dice rolls. The function asks the user to input the number of times they would like tio roll the dice, each roll contains two dice. Another function takes two lists as parameters (these are the lists of dice rolls) and analyzes the dice rolls. For each pair, of both dice are 1, your total for the game is reset to 0. If the dice are the same but less than or equal to 4, add the value if one if the dice to your total. If they are the same and greater than 4, add the value of both doce to your total. If they are different and the sum is greater than 6, add half the sum to your total. If they are diferent and the sum is 6 or less, subtract the sum from your total. This functon can return whatever data you decide is necessary. A print function prints out the details of the game in nicely formated output. This print function can take whatever parameters you choose, the design is up to you. Ensure your program has a TheEnd function. Use a main functin to run the program.

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_2

Step: 3

blur-text-image_3

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

Advances In Databases And Information Systems Second East European Symposium Adbis 98 Poznan Poland September 1998 Proceedings Lncs 1475

Authors: Witold Litwin ,Tadeusz Morzy ,Gottfried Vossen

1st Edition

3540649247, 978-3540649243

More Books

Students also viewed these Databases questions