Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(Python) Assume a shark is born without any teeth and gains teeth at a rate of e

ID: 662215 • Letter: #

Question

(Python) Assume a shark is born without any teeth and gains teeth at a rate of exactly 1 new tooth every 4 days, while losing a uniform random fraction between 0.00 to 0.02 of its current number of teeth whenever it feeds (every 3 days we will assume). Write a function sharkTeeth(N) that uses random numbers to simulate and return the number of teeth a shark has after N days. Hint: Think of how to use random.uniform and the mod (%) operator. (Use Python please)

Write a function monteCarloSharkTeethProb(nTeeth, nDays, nTrials) that calculates and returns the probability that a nDays old shark will have more than nTeeth (by performing nTrials number of

Explanation / Answer

class Item(object): """Class implementing a ressource, which is used tu build improvement for the castle""" name = ''; icon = ''; def __init__(self): super(Ressource, self).__init__() self.Value = value; #Subclasses class SharkTeeth(Item): """First type of ressource, dropped on sea monster""" name = 'SharkTeeth' # icon = pyglet.image.load('images/ressources/SharkTeeth.png') def __init__(self): super(SharkTeeth, self).__init__() class Ruby(Item): """Third type of ressource, taken in chest""" name = 'Ruby' # icon = pyglet.image.load('images/ressources/ruby.png') def __init__(self): super(Ruby, self).__init__() class BearTeeth(Item): """Second type of ressource, drop on jungle monster""" name = 'BearTeeth' # icon = pyglet.image.load('images/ressources/ruby.png') def __init__(self): super(BearTeeth, self).__init__() if __name__ == '__main__': pass