Untitled

From Coral Bee, 4 Months ago, written in Plain Text, viewed 57 times.
URL http://codebin.org/view/6773170b Embed
Download Paste or View Raw
  1. import numpy as np
  2.  
  3. spot_matrix = np.array(
  4.     [
  5.         [10, 11, 12, 13, 14, 15],
  6.         [11, 12, 13, 14, 15, 16],
  7.         [12, 13, 14, 15, 16, 17],
  8.         [13, 14, 15, 16, 17, 18],
  9.         [14, 15, 16, 17, 18, 19],
  10.         [15, 16, 17, 18, 19, 20],
  11.     ]
  12. )
  13.  
  14. spot_counts = {}
  15. for i in range(0, 6):
  16.         for j in range(0, 6):
  17.                 if spot_matrix[i][j] not in spot_counts.keys():
  18.                         spot_counts[spot_matrix[i][j]] = 1
  19.                 else:
  20.                         spot_counts[spot_matrix[i][j]] += 1
  21.  
  22. spot_probs = {k:spot_counts[k]/36 for k in spot_counts}
  23.  
  24. sum_probs_one = round(spot_probs.values().sum())
  25.  
  26. print(spot_probs)
  27. print(sum_probs_one)

Reply to "Untitled"

Here you can reply to the paste above