Need help with your Discussion

Get a timely done, PLAGIARISM-FREE paper
from our highly-qualified writers!

glass
pen
clip
papers
heaphones

Module 5 Assignment 2: Modular Design of Two Python Programs

Module 5 Assignment 2: Modular Design of Two Python Programs

Module 5 Assignment 2: Modular Design of Two Python Programs

Question Description

Overview

In Module 5 Assignment 2, modify your pseudocode to make 1000 dicerolls, and instead of displaying the list, use Pygal to display theresults in a bar chart.

Instructions

M5 Assignment 2 uses both modules from M5-1 and asks you to modifythe second module to increase the number of rolls to 1000, to calculatehow frequently each number appears, and to display the results in a barchar, which is called a histogram in Pygal.

Some of the code is written for you, so review the two files formodule 1 in M5Lab2dice.py and module 2 in M5Lab2dice_hist.py file to seehow the lab works. Some of the code is missing in M5Lab2dice_hist.py.

Read both program files to see what is missing. You will revise your pseudocode and revise the M5Lab2dice_hist.py file.

Pseudocode – Revise module 2 in your pseudocode to add these steps:

  1. Roll the dice 1000 times
  2. Do not print the results
  3. Instead, print the frequencies from a list called frequencies[]
    1. Frequencies are the number of times each number appears
  4. Add the titles to your bar chart
    1. # They are string values that appear at the top
    2. # List the titles for the x axis and the y axis of your chart
    3. # See the example in the code to support your pseudocode
  5. Render the chart to appear in a “dice_barchart.svg” file
  6. Add your name to the chart’s title
  7. Test your chart by dragging the file dice_barchart.svg into any Web browser window
  8. If you see your bar chart with 6 columns, examine it
    1. Hover your cursor over each column to see the values for 1000 dice rolls
  9. Save your pseudocode as M5Lab2ii.docx

Python code – Revise module 2 in M5Lab2dice_hist.py to add these steps:

  1. import Pygal # Pygal draws the bar chart or histogram for you
  2. import the Dice class # from dice import Dice
  3. declare the variable dice and assign the value to the class name Dice()
    1. # variable_name = Class()
  4. Declare an empty list called results
  5. Declare an empty frequencies list for the tracking how often each die value appears
  6. Declare a variable frequency and assign it to results.count(value)
    1. # Tracks the number of times each value from 1-6 is rolled
  7. print the frequencies # the format is print(listname)
  8. Bar chart: declare a variable hist and assign it the value pygal.Bar()
  9. Declare a hist.title variable and set the value to the following
    1. Your Name – Results of 1000 6-Sided Dice Rolls
    2. Replace “Your Name” with your name
  10. Declare a hist.x_title and set the value to Result using a string
  11. Declare a hist.y_title and set the string value to “How Often Did We Roll a 1, 2, 3, 4, 5, or 6?”
    1. # Tip: do not copy the string values surrounded by quotes from A MS Word file.
    2. # They use the wrong quotation symbols. Retype the quotation marks in Python.
  12. Save your M5Lab2dice_hist.py file into the same folder as dice.py
    1. # Both program files must be in the same folder
  13. Run your M5Lab2dice_hist.py file and see if it lists in the Pythonshell the number of times each number appeared on the dice rolls.
  14. Open the folder with your labs in it
  15. The results and frequencies from 1000 rolls appear in a hist.render_to_file called “dice_barchart.svg”
  16. Drag the dice_barchart.svg file from your folder to a Web browser window to see your bar chart
  17. Hover over the columns to see the frequencies appear

Each lab asks you to write pseudocode that plans the program’s logicbefore you write the program in Python and to turn in three things: 1)the pseudocode, 2) the dice_barchart.svg file, which displays the outputas a bar chart, and 3) your Python program.

How to Complete Your M5 Assignment Modular Design of Two Python Programs

In the M5 Assignment 2 Modular Design of Two Python Programs Assignment Submission Folder:

  1. Upload M5Lab2dice_hist.py
  2. Upload your pseudocode in M5Lab2ii.docx
  3. Upload your dice_barchart.svg files to M5 Assignment 2 Modular Design of Two Python Programs Assignment Submission Folder.
    1. You do not need to post dice.py unless you made changes to the class file.
    2. If you changed your Dice() class or its attributes, attach the changed files.

See the Schedule in the Syllabus Module for due dates. Review the Rubric attached to the Assignment Submission Folder for grading information.

Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."

Order Solution Now

Our Service Charter


1. Professional & Expert Writers: Eminence Papers only hires the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2. Top Quality Papers: Our customers are always guaranteed of papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3. Plagiarism-Free Papers: All papers provided by Eminence Papers are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. Eminence Papers are known for the timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5. Affordable Prices: Our prices are fairly structured to fit in all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.

6. 24/7 Customer Support: At Eminence Papers, we have put in place a team of experts who answer all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.

We Can Write It for You! Enjoy 20% OFF on This Order. Use Code SAVE20

Stuck with your Assignment?

Enjoy 20% OFF Today
Use code SAVE20