You are viewing a single comment's thread. Return to all comments →
Python
Answer = 2/9
from fractions import Fraction places = [i for i in range(0, 10, 1)] total = 0 visited = [] for e, i in enumerate(places): for j in places[0:e] + places[e+1:]: if i == 0: if j == 9: visited.append([i, j]) elif j == 1: visited.append([i, j]) elif i == 9: if j == 0: visited.append([i, j]) elif j == 8: visited.append([i, j]) else: if (i == (j - 1)) or (i == (j + 1)): visited.append([i, j]) total += 1 print(Fraction(len(visited), total)) # 2/9
Seems like cookies are disabled on this browser, please enable them to open this website
Day 3: Basic Probability Puzzles #5
You are viewing a single comment's thread. Return to all comments →
Python
Answer = 2/9