Your Perfect Assignment is Just a Click Away
We Write Custom Academic Papers

100% Original, Plagiarism Free, Customized to your instructions!


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


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


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

Some of the code is written for you, so review the two files for
module 1 in and module 2 in file to see
how the lab works. Some of the code is missing in

Read both program files to see what is missing. You will revise your pseudocode and revise the 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 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 file into the same folder as
    1. # Both program files must be in the same folder
  13. Run your file and see if it lists in the Python
    shell 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 logic
before you write the program in Python and to turn in three things: 1)
the pseudocode, 2) the dice_barchart.svg file, which displays the output
as 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
  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 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.

We offer the best custom essay writing services at an affordable rate. We have done this assignment before, we can also do it for you.

Order Solution Now

Our Service Charter

1. Professional & Expert Writers: Essay Pillars 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 Essay Pillars 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. Essay Pillars is known for 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 Essay Pillars, we have put in place a team of experts who answer to all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.