Expert answer:lab 11 modification

Solved by verified expert:modify the code that I uploaded in order to get the output that I uploaded. I also uploaded the instructions
lab_11_code.pdf

lab_11_instructions.pdf

the_produced_output.pdf

Unformatted Attachment Preview

11/11/2017
https://www.cs.montana.edu/paxton/classes/csci127/inlabs/lab11/lab11.py
import numpy as np
import random
#
#
#
#
#
————————————————CSCI 127, Lab 11
November 14, 2017
Your Name
————————————————-
class Die:
def __init__(self, sides):
“””A constructor method to create a die”””
self.sides = sides
def roll(self):
“””A general method to roll the die”””
return random.randint(1, self.sides)
# ————————————————class Yahtzee:
def __init__(self):
“””A constructor method that can record 5 dice rolls”””
self.rolls = np.zeros(5, dtype=np.int16)
def roll_dice(self):
“””A general method that rolls 5 dice”””
for i in range(len(self.rolls)):
self.rolls[i] = Die(6).roll()
def count_outcomes(self):
“””A helper method that determines how many 1s, 2s, etc. were rolled”””
counts = np.zeros(7, dtype=np.int16)
for roll in self.rolls:
counts[roll] += 1
return counts
# ————————————————def main(how_many):
yahtzees = 0
full_houses = 0
large_straights = 0
game = Yahtzee()
for i in range(how_many):
game.roll_dice()
if game.is_it_yahtzee():
yahtzees += 1
elif game.is_it_full_house():
full_houses += 1
elif game.is_it_large_straight():
large_straights += 1
print(“Number of Rolls:”, how_many)
print(“———————“)
print(“Number of Yahtzees:”, yahtzees)
print(“Yahtzee Percent:”, “{:.2f}%n”.format(yahtzees * 100 / how_many))
print(“Number of Full Houses:”, full_houses)
print(“Full House Percent:”, “{:.2f}%n”.format(full_houses * 100 / how_many))
print(“Number of Large Straights:”, large_straights)
https://www.cs.montana.edu/paxton/classes/csci127/inlabs/lab11/lab11.py
1/2
11/11/2017
https://www.cs.montana.edu/paxton/classes/csci127/inlabs/lab11/lab11.py
print(“Large Straight Percent:”, “{:.2f}%”.format(large_straights * 100 / how_many))
# ————————————————main(5000)
https://www.cs.montana.edu/paxton/classes/csci127/inlabs/lab11/lab11.py
2/2
11/11/2017
CSCI 127, In-Lab 11
Lab 11: NumPy arrays
Logistics
Due: Tuesday, November 14th no later than midnight.
Partner Information: Complete this assignment individually.
Submission Instructions: Upload your solution, named YourFirstName-YourLastName.py to the
BrightSpace Lab 11 Dropbox.
Deadline Reminder: Once this deadline passes, BrightSpace will no longer accept your Python submission
and you will no longer be able to earn credit. Thus, if you are not able to fully complete the assignment,
submit whatever you have before the deadline so that partial credit can be earned.
Learning Outcomes
Gain experience using NumPy arrays to solve problems.
Background
In the game of Yahtzee, five six-sided dice are rolled.
For this assignment, you will simulate a simplified version of Yahtzee.
In this simplified version of Yahtzee, a yahtzee occurs when all five dice show the same number (for
example, 3-3-3-3-3).
In this simplified version of Yahtzee, a full house occurs when three dice show one number and two dice
show another (for example, 4-4-2-4-2).
In this simplified version of Yahtzee, a large straight occurs when the five numbers can be arranged
consecutively from either 1 thru 5 or from 2 thru 6 (for example, 1-3-4-2-5 or 5-2-4-6-3).
Assignment
Download lab11.py, rename it according to the instructions above, and make sure you understand it.
Take the program above and modify it by adding the missing methods such that when the program is run,
it might produce this output. Do not change any of the existing Python code.
Grading – 10 points
3 points – Yahtzees are identified correctly.
3 points – Full houses are identified correctly.
4 points – Large straights are identified correctly.
If Time Remains
Work on Program 5, seeking feedback from your lab assistant if desired.
https://www.cs.montana.edu/paxton/classes/csci127/inlabs/lab11/
1/1
11/11/2017
https://www.cs.montana.edu/paxton/classes/csci127/inlabs/lab11/output.txt
Number of Rolls: 5000
——————–Number of Yahtzees: 1
Yahtzee Percent: 0.02%
Number of Full Houses: 202
Full House Percent: 4.04%
Number of Large Straights: 144
Large Straight Percent: 2.88%
https://www.cs.montana.edu/paxton/classes/csci127/inlabs/lab11/output.txt
1/1

Purchase answer to see full
attachment

How it works

  1. Paste your instructions in the instructions box. You can also attach an instructions file
  2. Select the writer category, deadline, education level and review the instructions 
  3. Make a payment for the order to be assignment to a writer
  4.  Download the paper after the writer uploads it 

Will the writer plagiarize my essay?

You will get a plagiarism-free paper and you can get an originality report upon request.

Is this service safe?

All the personal information is confidential and we have 100% safe payment methods. We also guarantee good grades

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more

Order your essay today and save 20% with the discount code ESSAYHELP