from IPython.display import YouTubeVideo
YouTubeVideo('ZLTyX4zL2Fc')
import random
import numpy as np
%%time
simulations = 1000000
sim_counter = 1
jumps_list = list()
while sim_counter <= simulations:
current = 1
last = 10
jumps = 0
while current < last:
# print("Current: {}".format(current))
choice = random.randint(1, last-current)
# print("Choice: {}".format(choice))
current += choice
jumps += 1
# print("Jumped to: {}".format(current))
# print("Jumps: {}".format(jumps))
jumps_list.append(jumps)
sim_counter += 1
# print("Jumps: {}".format(jumps_list))
print("Jumps: {}".format(np.mean(jumps_list)))
by Wojciech Wiertarka