In: Computer Science
PYTHON PLEASE--------
For the first module, write the pseudocode to process these
tasks:
(Note: lines beginning with # are comments with tips for you)
For the second module, write the pseudocode to complete these tasks:
'''
Python version : 2.7
Python program to create and implement a Dice class
'''
from random import randint
#class Dice
class Dice():
# constructor
def __init__(self,dice_sides = 6):
self.num_sides = dice_sides
# roll function
def roll(self):
return randint(1,self.num_sides)
# create an object of Dice class
dice = Dice()
result = [] # list to store the result of rolling a die
# loop to roll a die 100 times and append it to result list
for i in range(100):
result.append(dice.roll())
# print the result
print(result)
#end of program
Code Screenshot:
Output: