[Solved] SOLVED:LAB 9

30 $

File Name: SOLVED:LAB_9.zip
File Size: 113.04 KB

SKU: [Solved] SOLVED:LAB 9 Category: Tag:

Or Upload Your Assignment Here:


Exercise 1 The Dice object was described in class in the following way: # # dice.py # Class definition for a multi-sided dice. # from random import randrange class Dice: def __init__(self, sides): self.sides = sides self.value = 1 def roll(self): self.value = randrange(1, self.sides+1) def getValue(self): return self.value def setValue(self, value): self.value = value def Main(): d = Dice(6) d.roll() print(“Value: “, d.getValue()) if __name__ == ‘__main__’: Main() Save the Dice program in cs177/lab09/dice.py Then write a dice game program that rolls the dice with you. Here is an example of the input/output: Press

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] SOLVED:LAB 9
30 $