Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import random

NUM_TRIALS = 500
NUM_TURNS_IN_TRIAL = 10


DIRECTIONS = [-1, 1] # do we go in the positive direction or the negative direction?
  
def pick_move():
  distance = random.randint(1, 10)
  direction = random.choice(DIRECTIONS)
  
  return distance * direction


def generate_overall_move():
  turns = [pick_move() for _ in range(NUM_TURNS_IN_TRIAL)]
  return sum(turns)

for _ in range(NUM_TRIALS):
  print(generate_overall_move())
Python 3.6.1 (default, Dec 2015, 13:05:11) [GCC 4.8.2] on linux