Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

**Please read carefully! Program needs to work not only for the sample code provided, but for every possible user input (i.e. 5 games, 10 flips

**Please read carefully! Program needs to work not only for the sample code provided, but for every possible user input (i.e. 5 games, 10 flips per game; 10 games, 13 flips per game, etc.) The output needs to be displayed exactly as it is seen in the sample output, and needs to show the total wins of each player displayed once the game has ended. I have been struggling with this code very much, so any insight is appreciated!

Your task in this programming assignment is to write a Python program that plays the Heads and tails...sort of game. Recall the game: two coins are simultaneously flipped, and the results are recorded. The two coins can either both be heads, both be tails, or they can be different (i.e., one is heads and one is tails). If both coins land on heads, Group A gets a point. If both coins land on tails, Group B gets a point. If one coin lands on heads and the other lands on tails, the Prof gets a point. The group (or individual) with the most points at the end of a game wins.Of course, the purpose of this program is to play this game many times, and for each game make many flips of the coins. In the end, we should see interesting results.

Before listing any requirements, let's take a look at a sample run of a correct program (with user input highlighted in bold red):

image text in transcribed From the sample run, several things can be observed that help to identify and clarify requirements, specifics, and/or constraints: (1) You must obtain user input for the total number of games to play and the total number of coin tosses per game; (2) For each game, you must properly make and record the coin tosses, and determine a winner; (3) Statistics must be displayed for each game, including the number of coin toss wins and percentage of coin toss wins for each group; (4) Statistics must be displayed over all the games, including the number of games won and percentage of games won for each group; (5) You must include a meaningful header, use good coding style, use meaningful variable names, and comment your source code where appropriate; (6) Your output should be like the sample runs shown above (of course, actual input values and the resulting output will vary depending on the provided inputs); and (7) You must submit your source code as a single .py file.

How many games? 1000 How many coin tosses per game? 1000 Game 0: Group A: 277 (27.74); Group B: 240 (24.0%); Prof: 483 (48.3%) Game 1: Group A: 265 (26.5%); Group B: 226 (22.6%); Prof: 509 (50.9%) Game 998: Game 999: Wins : Group A=0 Group A: 241 (24.1%); Group B: 257 (25.7%); Prof: 502 (50.2%) (25.1%); (0.09); 254 (25.4%); B: 251 B=0 Group A: Group Prof: 495 (49.5%) (0.0%); Group Prof-1000 (100.0%)

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

Database Design For Mere Mortals

Authors: Michael J Hernandez

4th Edition

978-0136788041

More Books

Students also viewed these Databases questions

Question

What is the use of bootstrap program?

Answered: 1 week ago

Question

What is a process and process table?

Answered: 1 week ago

Question

What is Industrial Economics and Theory of Firm?

Answered: 1 week ago