Friday, October 10, 2014

Answer to Monday.

import random

M = 24

totalCorrect = 0
for k in range(1, 100000):
    correct = 0
    term = random.randrange(1, M)
     for j in range(1, M):
        if term = j:
            correct += 1


    totalCorrect = totalCorrect + correct

print(totalCorrect/1000000)
 So here it, a python answer to Mondays problem. So far so good, aimed fro three posts this week, got three posts up this week. It's really the answer in the book, converted to a python answer. Have a good weekend, and stay safe.

No comments:

Post a Comment