Module 5 Assignment 1: Pseudocode for Python Program Integration

posted in: Research Paper | 0


Module 5 Assignment 1 features the design of pseudocode to support a Python program that requires coordination between the control structures and modules of two programs. This lab asks you to write pseudocode that plans the program’s logic before you write the program in Python in the next assignment. You will turn in only the pseudocode for the two modules for M5 Assignment 1.


Write pseudocode for a Python program that makes 100 dice rolls with a single 6-sided die and displays the number of times each side appeared. Turn in the two modules for the pseudocode for the following instructions. The following steps describe what we want our two program modules to do.

Before proceding, download the files,, and, as all will be referenced in your assignments this week. To find these files, reference the folder Module 5>Assignments>Exercises. These files were also in the zip file you downloaded in Module 1.

Requirements for Your M5 Assignment 1 Pseudocode for Program Integration

For the first module, write the pseudocode to process these tasks:
(Note: lines beginning with # are comments with tips for you)

  1. From the random module import randint to roll each die randomly
    1. # in pseudocode, import a random function
    2. # the name is helpful for the next M5-2 assignment
  2. Define a class called Dice
    1. In Python, the syntax has a colon after it: class Dice():
    2. In pseudocode, you can specify it generally or be specific
  3. Under the class declaration, list the attributes. Here are some tips:
    1. # attributes are what we know about a single die (dice is plural)
    2. # self is the first attribute in Python and must always appear first
    3. # add a num_sides attribute and to set it to 6 for the 6 sides on the dice
  4. Define a method for roll(self)
    1. # it describes what happens when we roll a single die
    2. # in the code, it will look like this example
      1. def __init__(self, dice_sides=6):
      2. # in pseudocode, we do not worry about the punctuation
      3. # just list it as part of your logic
  5. Under roll(self), return a random int value between 1 and self.dice_sides
  6. Save this file as M5Lab1ii – you can save it as MS Word or a text file.

For the second module, write the pseudocode to complete these tasks:

  1. In the same M5Lab1ii file, start a second module below the first module.
  2. From a new dice module, import our Dice class
  3. Create a 6-sided die by using assignment # for example: dice = Dice()
  4. Create an empty results list
  5. Write a for statement that takes each roll_num in range() and rolls it 100 times
  6. Set the value of result to dice.roll()
  7. For each roll and append it to the results list using your list’s name and .append() with the variable for each dice roll inside the parameters for append(). For example:
    1. # yourlistname.append(result)
  8. Refer to the name of your list within the print() parameter to print the results.
  9. 100 dice rolls for the values 1-6 appear in a list on the Python shell.
  10. Save the two modules in M5Lab1ii – you can save it as MS Word or a text file.

How to Complete Your M5 Assignment 1 Pseudocode for Program Integration

  1. Save your M5Lab1ii (ii= your initials). [example for someone with the initials cc:]
  2. Upload the M5Lab1ii document with two modules to M5 Assignment 1 Pseudocode for Python Program Integration Assignment Submission Folder. See the Schedule in the Syllabus Module for due dates. Review the Rubric attached to the Assignment Submission Folder for grading information.


Last Updated on August 9, 2019 by EssayPro